Skip to content

Enhance Gemma 4 performance and features across multiple areas#11

Merged
Snider merged 785 commits into
mainfrom
dev
Jul 22, 2026
Merged

Enhance Gemma 4 performance and features across multiple areas#11
Snider merged 785 commits into
mainfrom
dev

Conversation

@Snider

@Snider Snider commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 1475 files, which is 1375 over the limit of 100.

To get a review, narrow the scope:
• coderabbit review --committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

Upgrade to a paid plan to raise the limit.

Usage-priced reviews support at most 300 files.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 992913a2-951c-4595-8619-34bdaac6e0fd

📥 Commits

Reviewing files that changed from the base of the PR and between 9e51817 and 33b907c.

⛔ Files ignored due to path filters (10)
  • cli/go.sum is excluded by !**/*.sum
  • examples/go.sum is excluded by !**/*.sum
  • go/go.sum is excluded by !**/*.sum
  • go/kv/turboquant/testdata/real_kv_keys.bin is excluded by !**/*.bin
  • go/kv/turboquant/testdata/real_kv_values.bin is excluded by !**/*.bin
  • go/model/arch/deepseek-ai/deepseekvl2/testdata/fixture.png is excluded by !**/*.png
  • go/model/arch/openai/whisper/testdata/hello16k.wav is excluded by !**/*.wav
  • go/model/arch/rednote-hilab/dotsocr/testdata/fixture.png is excluded by !**/*.png
  • go/model/arch/zai-org/glmocr/testdata/fixture.png is excluded by !**/*.png
  • gui/go.sum is excluded by !**/*.sum
📒 Files selected for processing (1565)
  • .gitignore
  • .gitlab-ci.yml
  • .graphifyignore
  • CLAUDE.md
  • Makefile
  • Taskfile.yml
  • bench/README.md
  • bench/gemma4.json
  • cli/bench.go
  • cli/capture.go
  • cli/capture_test.go
  • cli/data.go
  • cli/data_test.go
  • cli/generate.go
  • cli/go.mod
  • cli/judgedriver.go
  • cli/judgedriver_test.go
  • cli/judgetemplate.go
  • cli/judgetemplate_test.go
  • cli/lthn-model-pack/main.go
  • cli/main.go
  • cli/main_test.go
  • cli/ocr.go
  • cli/pack.go
  • cli/quant_test.go
  • cli/serve.go
  • cli/serve_test.go
  • cli/ssd.go
  • cli/ssd_test.go
  • cli/transcribe.go
  • cli/transcribe_test.go
  • cli/tui/README.md
  • cli/tui/agentadapter.go
  • cli/tui/agentadapter_test.go
  • cli/tui/agentcap.go
  • cli/tui/agentcap_test.go
  • cli/tui/agentoverlay.go
  • cli/tui/agentoverlay_test.go
  • cli/tui/agentstore.go
  • cli/tui/agentstore_test.go
  • cli/tui/app.go
  • cli/tui/app_test.go
  • cli/tui/bootstrap.go
  • cli/tui/bootstrap_test.go
  • cli/tui/dataoverlay.go
  • cli/tui/dataoverlay_test.go
  • cli/tui/datapanel.go
  • cli/tui/datapanel_test.go
  • cli/tui/datasetmigrations.go
  • cli/tui/datasetmigrations_test.go
  • cli/tui/datasetstore.go
  • cli/tui/datasetstore_test.go
  • cli/tui/export.go
  • cli/tui/export_test.go
  • cli/tui/inspector.go
  • cli/tui/inspector_test.go
  • cli/tui/jobs.go
  • cli/tui/jobs_test.go
  • cli/tui/keymap.go
  • cli/tui/keymap_test.go
  • cli/tui/knowledge.go
  • cli/tui/knowledge_test.go
  • cli/tui/layout.go
  • cli/tui/layout_test.go
  • cli/tui/markdown.go
  • cli/tui/markdown_bench_test.go
  • cli/tui/markdown_test.go
  • cli/tui/migrations.go
  • cli/tui/migrations_test.go
  • cli/tui/modes.go
  • cli/tui/palette.go
  • cli/tui/palette_test.go
  • cli/tui/paths.go
  • cli/tui/paths_test.go
  • cli/tui/picker.go
  • cli/tui/preferences.go
  • cli/tui/preferences_test.go
  • cli/tui/reactive.go
  • cli/tui/reactive_test.go
  • cli/tui/records.go
  • cli/tui/records_test.go
  • cli/tui/repository.go
  • cli/tui/repository_test.go
  • cli/tui/runtime.go
  • cli/tui/runtime_test.go
  • cli/tui/service.go
  • cli/tui/sessions.go
  • cli/tui/sessions_test.go
  • cli/tui/settings.go
  • cli/tui/stream.go
  • cli/tui/style.go
  • cli/tui/tabs.ctml
  • cli/tui/tabs.go
  • cli/tui/tabs_test.go
  • cli/tui/tools.go
  • cli/tui/tui.go
  • cli/tui/tui_test.go
  • cli/tui/work.go
  • cli/tui/work_test.go
  • cli/tune.go
  • docs/RFC.models.md
  • docs/backends.md
  • docs/cmd-lem.md
  • docs/design-composability.md
  • docs/design-rocm.md
  • docs/engine-merge.md
  • docs/examples/energy-ab/README.md
  • docs/examples/energy-ab/energy_turns.py
  • docs/examples/energy-ab/pm_integrate.py
  • docs/hip-12b-r10-route-table.md
  • docs/hip-12b-r11-feedback-pin.md
  • docs/hip-12b-r12-sampler-fix.md
  • docs/hip-12b-r13-close.md
  • docs/hip-12b-r14-close.md
  • docs/hip-12b-r15-close.md
  • docs/hip-12b-r15-spread.md
  • docs/hip-12b-r16-topk-fork.md
  • docs/history.md
  • docs/index.md
  • docs/mamba1-mamba2-compatibility-audit.md
  • docs/models.md
  • docs/policy-g2-mediated-rewrite.md
  • docs/release-v0.12.0-DRAFT.md
  • examples/.gitignore
  • examples/README.md
  • examples/budget
  • examples/go.mod
  • examples/pkg/chat/mtp/README.md
  • examples/pkg/chat/mtp/main.go
  • examples/pkg/dflash/README.md
  • examples/pkg/dflash/main.go
  • examples/pkg/dotsocr/README.md
  • examples/pkg/dotsocr/main.go
  • examples/pkg/embed/main.go
  • examples/pkg/glmocr/README.md
  • examples/pkg/glmocr/main.go
  • examples/pkg/hybrid-quant/README.md
  • examples/pkg/hybrid-quant/main.go
  • examples/pkg/kvcache-turboquant/README.md
  • examples/pkg/kvcache-turboquant/main.go
  • examples/pkg/ocr/README.md
  • examples/pkg/ocr/main.go
  • examples/pkg/packed-moe/README.md
  • examples/pkg/packed-moe/main.go
  • examples/pkg/quantise/README.md
  • examples/pkg/reasoning-preservation/README.md
  • examples/pkg/reasoning-preservation/main.go
  • examples/pkg/rerank/main.go
  • examples/pkg/rwkv7-generate/README.md
  • examples/pkg/rwkv7-generate/main.go
  • examples/pkg/transcribe/README.md
  • examples/pkg/transcribe/main.go
  • examples/sdk/php/main.php
  • examples/tools
  • go/agent/agent.go
  • go/agent/agent_execute.go
  • go/agent/agent_ssh.go
  • go/agent/ai/book_state_demo_http.go
  • go/agent/ai/metrics.go
  • go/agent/gitserver/gitserver.go
  • go/agent/gitserver/gitserver_example_test.go
  • go/agent/gitserver/gitserver_test.go
  • go/agent/gitserver/softserve.go
  • go/agent/gitserver/softserve_example_test.go
  • go/agent/gitserver/softserve_test.go
  • go/agent/helpers.go
  • go/agent/orchestrator/accept.go
  • go/agent/orchestrator/accept_example_test.go
  • go/agent/orchestrator/accept_test.go
  • go/agent/orchestrator/native.go
  • go/agent/orchestrator/native_example_test.go
  • go/agent/orchestrator/native_test.go
  • go/agent/orchestrator/orchestrator.go
  • go/agent/orchestrator/orchestrator_example_test.go
  • go/agent/orchestrator/orchestrator_test.go
  • go/agent/orchestrator/run.go
  • go/agent/orchestrator/run_bench_test.go
  • go/agent/orchestrator/run_example_test.go
  • go/agent/orchestrator/run_test.go
  • go/agent/orchestrator/store.go
  • go/agent/orchestrator/store_example_test.go
  • go/agent/orchestrator/store_test.go
  • go/agent/provider/claude.go
  • go/agent/provider/claude_example_test.go
  • go/agent/provider/claude_test.go
  • go/agent/provider/codex.go
  • go/agent/provider/codex_example_test.go
  • go/agent/provider/codex_test.go
  • go/agent/provider/opencode.go
  • go/agent/provider/opencode_example_test.go
  • go/agent/provider/opencode_test.go
  • go/agent/provider/parser.go
  • go/agent/provider/parser_bench_test.go
  • go/agent/provider/parser_example_test.go
  • go/agent/provider/parser_test.go
  • go/agent/provider/provider.go
  • go/agent/provider/provider_example_test.go
  • go/agent/provider/provider_test.go
  • go/agent/queue/config.go
  • go/agent/queue/config_example_test.go
  • go/agent/queue/config_test.go
  • go/agent/queue/controller.go
  • go/agent/queue/controller_bench_test.go
  • go/agent/queue/controller_example_test.go
  • go/agent/queue/controller_test.go
  • go/agent/work/work.go
  • go/agent/work/work_bench_test.go
  • go/agent/work/work_example_test.go
  • go/agent/work/work_test.go
  • go/agent/worker.go
  • go/agent/workspace/accept.go
  • go/agent/workspace/accept_example_test.go
  • go/agent/workspace/accept_test.go
  • go/agent/workspace/git.go
  • go/agent/workspace/git_example_test.go
  • go/agent/workspace/git_test.go
  • go/agent/workspace/workspace.go
  • go/agent/workspace/workspace_bench_test.go
  • go/agent/workspace/workspace_example_test.go
  • go/agent/workspace/workspace_test.go
  • go/dataset/dataset.go
  • go/dataset/dataset_example_test.go
  • go/dataset/dataset_test.go
  • go/dataset/doc.go
  • go/dataset/export.go
  • go/dataset/export_example_test.go
  • go/dataset/export_test.go
  • go/dataset/hash.go
  • go/dataset/hash_example_test.go
  • go/dataset/hash_test.go
  • go/dataset/ingest.go
  • go/dataset/ingest_example_test.go
  • go/dataset/ingest_test.go
  • go/dataset/score.go
  • go/dataset/score_example_test.go
  • go/dataset/score_test.go
  • go/dataset/screen.go
  • go/dataset/screen_test.go
  • go/dataset/store.go
  • go/dataset/store_example_test.go
  • go/dataset/store_test.go
  • go/decode/dflash/dflash.go
  • go/decode/dflash/dflash_test.go
  • go/decode/dflash/testdata/zlab_qwen3_4b_oracle.json
  • go/decode/dflash/zlab.go
  • go/decode/dflash/zlab_test.go
  • go/decode/generate/generate.go
  • go/decode/generate/generate_retained_session_test.go
  • go/decode/generate/generate_state.go
  • go/decode/generate/generate_test.go
  • go/decode/generate/multimodal.go
  • go/decode/parser/registry_test.go
  • go/decode/tokenizer/sentencepiece_model.go
  • go/decode/tokenizer/tokenizer.go
  • go/discover.go
  • go/docs/composed-strip-inventory.md
  • go/docs/zoo-moe-real-checkpoint-parity.md
  • go/engine/chat_template.go
  • go/engine/chat_template_test.go
  • go/engine/enginetest/quant_parity.go
  • go/engine/enginetest/quant_reference.go
  • go/engine/enginetest/quant_reference_test.go
  • go/engine/hip/GEMMA4_PERFORMANCE.md
  • go/engine/hip/PRODUCTION_READINESS.md
  • go/engine/hip/architecture.go
  • go/engine/hip/architecture_test.go
  • go/engine/hip/attached_drafter_textmodel.go
  • go/engine/hip/composed_runtime.go
  • go/engine/hip/composed_runtime_test.go
  • go/engine/hip/decode_helpers.go
  • go/engine/hip/decode_phase_trace.go
  • go/engine/hip/decode_phase_trace_test.go
  • go/engine/hip/decode_reference_test.go
  • go/engine/hip/dense_config.go
  • go/engine/hip/diffusion_native_session.go
  • go/engine/hip/diffusion_session.go
  • go/engine/hip/diffusion_session_test.go
  • go/engine/hip/gemma4_architecture_adapter.go
  • go/engine/hip/gemma4_architecture_adapter_test.go
  • go/engine/hip/gemma4_audio_tower.go
  • go/engine/hip/gemma4_audio_tower_test.go
  • go/engine/hip/gemma4_engine_features.go
  • go/engine/hip/gemma4_engine_features_test.go
  • go/engine/hip/gemma4_model_features_bridge.go
  • go/engine/hip/gemma4_model_pack.go
  • go/engine/hip/gemma4_model_pack_portable.go
  • go/engine/hip/gemma4_native_config.go
  • go/engine/hip/gemma4_production_quantization.go
  • go/engine/hip/gemma4_unified_model_pack_test.go
  • go/engine/hip/gemma4_unified_vision.go
  • go/engine/hip/gemma4_unified_vision_test.go
  • go/engine/hip/gemma4_vision_encoder.go
  • go/engine/hip/gemma4_vision_encoder_test.go
  • go/engine/hip/hip_adamw_launch.go
  • go/engine/hip/hip_assert_portable_test.go
  • go/engine/hip/hip_attached_drafter_generate.go
  • go/engine/hip/hip_attached_drafter_verifier_plan.go
  • go/engine/hip/hip_audio_wav.go
  • go/engine/hip/hip_autoround_quant_launch.go
  • go/engine/hip/hip_bf16_portable.go
  • go/engine/hip/hip_codebook_launch.go
  • go/engine/hip/hip_diffusion_sample_launch.go
  • go/engine/hip/hip_diffusion_sample_launch_test.go
  • go/engine/hip/hip_driver_cgo.go
  • go/engine/hip/hip_driver_cgo_test.go
  • go/engine/hip/hip_embedding_launch.go
  • go/engine/hip/hip_embedding_launch_test.go
  • go/engine/hip/hip_gemma4_moe.go
  • go/engine/hip/hip_gemma4_q4_engine_config.go
  • go/engine/hip/hip_gemma4_q4_kv.go
  • go/engine/hip/hip_gemma4_q4_lane_forward.go
  • go/engine/hip/hip_gemma4_q4_lane_forward_test.go
  • go/engine/hip/hip_gemma4_q4_layer.go
  • go/engine/hip/hip_gemma4_q4_oracle_test.go
  • go/engine/hip/hip_gemma4_q4_prefill.go
  • go/engine/hip/hip_gguf_affine_adapter.go
  • go/engine/hip/hip_gguf_affine_adapter_test.go
  • go/engine/hip/hip_hardware_test.go
  • go/engine/hip/hip_jangtq_launch.go
  • go/engine/hip/hip_kernel_source_test.go
  • go/engine/hip/hip_kernels.go
  • go/engine/hip/hip_kernels_test.go
  • go/engine/hip/hip_kv_device.go
  • go/engine/hip/hip_lane_set.go
  • go/engine/hip/hip_lane_set_test.go
  • go/engine/hip/hip_launch.go
  • go/engine/hip/hip_launch_test.go
  • go/engine/hip/hip_lora_launch.go
  • go/engine/hip/hip_lora_model.go
  • go/engine/hip/hip_lora_model_test.go
  • go/engine/hip/hip_lora_trainer.go
  • go/engine/hip/hip_lora_trainer_test.go
  • go/engine/hip/hip_moe_combine_norms.go
  • go/engine/hip/hip_moe_launch.go
  • go/engine/hip/hip_moe_launch_test.go
  • go/engine/hip/hip_native_kernels.go
  • go/engine/hip/hip_projection_launch.go
  • go/engine/hip/hip_projection_reference.go
  • go/engine/hip/hip_qwen3_moe_config.go
  • go/engine/hip/hip_qwen3_moe_hardware_test.go
  • go/engine/hip/hip_qwen3_moe_layer.go
  • go/engine/hip/hip_qwen3_moe_layer_test.go
  • go/engine/hip/hip_qwen3_moe_model.go
  • go/engine/hip/hip_qwen3_moe_router.go
  • go/engine/hip/hip_qwen3_moe_router_test.go
  • go/engine/hip/hip_runtime.go
  • go/engine/hip/hip_runtime_test.go
  • go/engine/hip/hip_small_decode.go
  • go/engine/hip/hip_small_decode_test.go
  • go/engine/hip/hip_tiny_model.go
  • go/engine/hip/hip_training_launch.go
  • go/engine/hip/hip_transformer_launch.go
  • go/engine/hip/hip_vision_image.go
  • go/engine/hip/inference_benchmark_test.go
  • go/engine/hip/inference_conformance_test.go
  • go/engine/hip/inference_kv_snapshot.go
  • go/engine/hip/inference_kv_snapshot_test.go
  • go/engine/hip/inference_memory.go
  • go/engine/hip/inference_memory_test.go
  • go/engine/hip/inference_model.go
  • go/engine/hip/inference_model_test.go
  • go/engine/hip/inference_session.go
  • go/engine/hip/inference_session_test.go
  • go/engine/hip/inference_state_blocks.go
  • go/engine/hip/inference_state_hardware_test.go
  • go/engine/hip/kernels/rocm_kernels.hip
  • go/engine/hip/kv_cache.go
  • go/engine/hip/kv_cache_raw.go
  • go/engine/hip/kv_cache_test.go
  • go/engine/hip/kv_contract.go
  • go/engine/hip/load_config.go
  • go/engine/hip/mamba2_runtime.go
  • go/engine/hip/mamba2_runtime_test.go
  • go/engine/hip/model/gemma4/identity_quant.go
  • go/engine/hip/model/gemma4/production_quantization.go
  • go/engine/hip/model/gemma4/qat_collection.go
  • go/engine/hip/model/gemma4/size_quant.go
  • go/engine/hip/model_pack.go
  • go/engine/hip/model_pack_api_stub.go
  • go/engine/hip/native.go
  • go/engine/hip/native_contract_test.go
  • go/engine/hip/portable_contract_stub.go
  • go/engine/hip/production_architecture_status.go
  • go/engine/hip/production_architecture_status_test.go
  • go/engine/hip/profile/architecture.go
  • go/engine/hip/qwen3_moe_runtime.go
  • go/engine/hip/qwen3_moe_runtime_test.go
  • go/engine/hip/reactive_sequence_mixer.go
  • go/engine/hip/scheduler.go
  • go/engine/hip/scheduler_test.go
  • go/engine/hip/trainer_capability_test.go
  • go/engine/metal/arch_gated_attn.go
  • go/engine/metal/arch_gated_delta.go
  • go/engine/metal/arch_gptoss_moe.go
  • go/engine/metal/arch_gptoss_moe_test.go
  • go/engine/metal/arch_qwen_fused.go
  • go/engine/metal/arch_qwen_moe.go
  • go/engine/metal/arch_qwen_moe_test.go
  • go/engine/metal/arch_session.go
  • go/engine/metal/arch_session_tq_hybrid_test.go
  • go/engine/metal/arch_session_tq_moe_test.go
  • go/engine/metal/arch_session_tq_test.go
  • go/engine/metal/assistant_dflash_proposer.go
  • go/engine/metal/assistant_dflash_zlab.go
  • go/engine/metal/assistant_dflash_zlab_acceptrate_test.go
  • go/engine/metal/assistant_dflash_zlab_round1_test.go
  • go/engine/metal/assistant_dflash_zlab_test.go
  • go/engine/metal/assistant_dflash_zlab_xfeed_test.go
  • go/engine/metal/assistant_draft_chain.go
  • go/engine/metal/assistant_draft_chain_test.go
  • go/engine/metal/assistant_draft_fused.go
  • go/engine/metal/assistant_draft_qhead.go
  • go/engine/metal/assistant_draft_qhead_test.go
  • go/engine/metal/assistant_gguf.go
  • go/engine/metal/assistant_load.go
  • go/engine/metal/assistant_load_test.go
  • go/engine/metal/attention.go
  • go/engine/metal/attn_core_backend.go
  • go/engine/metal/attn_core_backend_test.go
  • go/engine/metal/attn_qkv_device.go
  • go/engine/metal/backend.go
  • go/engine/metal/bf16_seam_backend.go
  • go/engine/metal/bf16_seam_backend_test.go
  • go/engine/metal/cache_plan.go
  • go/engine/metal/cache_plan_test.go
  • go/engine/metal/capture_hidden_olmoe_oracle_test.go
  • go/engine/metal/capture_hidden_qwen3_oracle_test.go
  • go/engine/metal/chained_gpu_decode_test.go
  • go/engine/metal/chat_template_config.go
  • go/engine/metal/composed_backend.go
  • go/engine/metal/composed_backend_test.go
  • go/engine/metal/composed_decode_census_test.go
  • go/engine/metal/composed_hook_receipts.go
  • go/engine/metal/composed_registry_test.go
  • go/engine/metal/coverage_guard_test.go
  • go/engine/metal/decode_batched_12b_parity_test.go
  • go/engine/metal/decode_batched_e4b_nan_test.go
  • go/engine/metal/decode_batched_session.go
  • go/engine/metal/decode_batched_tq.go
  • go/engine/metal/decode_batched_tq_test.go
  • go/engine/metal/decode_depth_tokps_test.go
  • go/engine/metal/decode_forward.go
  • go/engine/metal/decode_forward_arch.go
  • go/engine/metal/decode_forward_arch_icb.go
  • go/engine/metal/decode_forward_arch_icb_layout.go
  • go/engine/metal/decode_forward_arch_icb_layout_test.go
  • go/engine/metal/decode_forward_arch_icb_q8.go
  • go/engine/metal/decode_forward_arch_icb_q8_test.go
  • go/engine/metal/decode_forward_arch_icb_qkvbias_test.go
  • go/engine/metal/decode_forward_arch_icb_quant.go
  • go/engine/metal/decode_forward_arch_icb_tq.go
  • go/engine/metal/decode_forward_arch_quant.go
  • go/engine/metal/decode_forward_quant.go
  • go/engine/metal/decode_phase_trace.go
  • go/engine/metal/decode_phase_trace_test.go
  • go/engine/metal/decode_profile_hybrid_test.go
  • go/engine/metal/decode_step.go
  • go/engine/metal/decode_step_batched.go
  • go/engine/metal/decode_verify_icb.go
  • go/engine/metal/decode_verify_stack_icb.go
  • go/engine/metal/decode_verify_stack_icb_live_test.go
  • go/engine/metal/decode_verify_stack_icb_probe_test.go
  • go/engine/metal/decode_verify_stack_icb_test.go
  • go/engine/metal/decode_verify_stack_kvdiff_test.go
  • go/engine/metal/decode_verify_stack_kvq8_test.go
  • go/engine/metal/decode_verify_stack_mlp_chain_test.go
  • go/engine/metal/decode_verify_stack_qmmt_test.go
  • go/engine/metal/decode_verify_stack_rmsadd_test.go
  • go/engine/metal/decode_verify_stack_stretch_test.go
  • go/engine/metal/dflash_zlab.go
  • go/engine/metal/dflash_zlab_test.go
  • go/engine/metal/dispatch_sink.go
  • go/engine/metal/e4b_nocopy_test.go
  • go/engine/metal/encsend.go
  • go/engine/metal/ffn_activation_test.go
  • go/engine/metal/flash_prompt.go
  • go/engine/metal/fused_chain_backend.go
  • go/engine/metal/fused_chain_icb.go
  • go/engine/metal/fused_chain_moe.go
  • go/engine/metal/fused_chain_moe_test.go
  • go/engine/metal/fused_chain_targets.go
  • go/engine/metal/gated_delta_backend.go
  • go/engine/metal/gated_delta_input_device.go
  • go/engine/metal/gemma3_loader_test.go
  • go/engine/metal/gemma4_12b_mtp_shapes_test.go
  • go/engine/metal/gemma4_31b_qmm_dims_test.go
  • go/engine/metal/generate_bf16.go
  • go/engine/metal/generation_config.go
  • go/engine/metal/gpu_busy_probe.go
  • go/engine/metal/gpu_capture.go
  • go/engine/metal/head_host_topk.go
  • go/engine/metal/head_host_topk_test.go
  • go/engine/metal/head_nocopy.go
  • go/engine/metal/head_nocopy_test.go
  • go/engine/metal/inference_model.go
  • go/engine/metal/inference_register.go
  • go/engine/metal/inference_register_test.go
  • go/engine/metal/kernel_pso_stats_test.go
  • go/engine/metal/kernel_receipts_bench_test.go
  • go/engine/metal/kernels/lthn_attn_core.metal
  • go/engine/metal/kernels/lthn_attn_vappend_f32.metal
  • go/engine/metal/kernels/lthn_gated_delta.metal
  • go/engine/metal/kernels/lthn_q4_lm_head_argmax.metal
  • go/engine/metal/kernels/lthn_qmv_rows.metal
  • go/engine/metal/kernels/lthn_sdpa_rtdim.metal
  • go/engine/metal/kernels/lthn_sdpa_vector_q8.metal
  • go/engine/metal/kernels/lthn_silu_gate_mul.metal
  • go/engine/metal/kernels/lthn_tq_kv.metal
  • go/engine/metal/kernels/lthn_turboquant.metal
  • go/engine/metal/kv_scan_floor_test.go
  • go/engine/metal/lane_set.go
  • go/engine/metal/lane_set_gemm.go
  • go/engine/metal/lane_set_gemm_test.go
  • go/engine/metal/lane_set_memory_test.go
  • go/engine/metal/lane_set_sampling.go
  • go/engine/metal/layer.go
  • go/engine/metal/load.go
  • go/engine/metal/load_context_ram.go
  • go/engine/metal/load_context_ram_test.go
  • go/engine/metal/load_helpers_test.go
  • go/engine/metal/load_shared.go
  • go/engine/metal/load_shared_test.go
  • go/engine/metal/load_test.go
  • go/engine/metal/lthn_gated_delta.go
  • go/engine/metal/lthn_gated_delta_test.go
  • go/engine/metal/lthn_kernels.go
  • go/engine/metal/lthn_topk_reduce_test.go
  • go/engine/metal/mamba2_backend.go
  • go/engine/metal/mamba2_backend_test.go
  • go/engine/metal/mamba2_session_state_test.go
  • go/engine/metal/memory_watermark.go
  • go/engine/metal/memory_watermark_test.go
  • go/engine/metal/mistral_session_test.go
  • go/engine/metal/mlp_bf16.go
  • go/engine/metal/mlp_device.go
  • go/engine/metal/model_quant_parity_test.go
  • go/engine/metal/moe.go
  • go/engine/metal/moe_batch.go
  • go/engine/metal/moe_block.go
  • go/engine/metal/moe_block_test.go
  • go/engine/metal/moe_clamped_swiglu.go
  • go/engine/metal/moe_clamped_swiglu_test.go
  • go/engine/metal/moe_quant_test.go
  • go/engine/metal/moe_zoo_generate_test.go
  • go/engine/metal/mtp.go
  • go/engine/metal/mtp_bench_test.go
  • go/engine/metal/mtp_boundary_trace.go
  • go/engine/metal/mtp_exact_lane_test.go
  • go/engine/metal/mtp_reengage_test.go
  • go/engine/metal/mtp_rows_diag_26b_real_test.go
  • go/engine/metal/mtp_rows_driver.go
  • go/engine/metal/mtp_rows_driver_test.go
  • go/engine/metal/mtp_rows_moe.go
  • go/engine/metal/mtp_rows_moe_test.go
  • go/engine/metal/nocopy_weights.go
  • go/engine/metal/owned_bind_test.go
  • go/engine/metal/paged_kv_delta_test.go
  • go/engine/metal/paged_kv_device.go
  • go/engine/metal/paged_kv_device_geometry_test.go
  • go/engine/metal/paged_kv_test.go
  • go/engine/metal/piece_timing.go
  • go/engine/metal/probe_chained_tail_share_test.go
  • go/engine/metal/probe_prompt_reuse_parity_test.go
  • go/engine/metal/probe_train_forward_split_test.go
  • go/engine/metal/projector.go
  • go/engine/metal/projector_test.go
  • go/engine/metal/qknorm_rope.go
  • go/engine/metal/qknorm_rope_test.go
  • go/engine/metal/qmm_prompt_bench_test.go
  • go/engine/metal/qmv_rows.go
  • go/engine/metal/qmv_rows_test.go
  • go/engine/metal/quant_moe_fuse_bench_test.go
  • go/engine/metal/quant_moe_fuse_test.go
  • go/engine/metal/quant_seam_backend.go
  • go/engine/metal/quant_seam_backend_test.go
  • go/engine/metal/qwen3_decode_sanity_test.go
  • go/engine/metal/qwen3_gated_delta_backend_test.go
  • go/engine/metal/qwen_mtp_pair_test.go
  • go/engine/metal/qwen_vision.go
  • go/engine/metal/qwen_vision_device.go
  • go/engine/metal/qwen_vision_device_test.go
  • go/engine/metal/qwen_vision_encoder.go
  • go/engine/metal/qwen_vision_encoder_test.go
  • go/engine/metal/qwen_vision_model_test.go
  • go/engine/metal/real_checkpoint_gpu_test.go
  • go/engine/metal/real_checkpoint_olmoe_gpu_test.go
  • go/engine/metal/registry_arches_test.go
  • go/engine/metal/residual_norm_mlp_proj_gated_delta_input_device.go
  • go/engine/metal/residual_norm_mlp_quant_device.go
  • go/engine/metal/residual_norm_mlp_quant_device_test.go
  • go/engine/metal/rope_freqs_session_test.go
  • go/engine/metal/router.go
  • go/engine/metal/router_bench_test.go
  • go/engine/metal/router_test.go
  • go/engine/metal/rwkv7_backend.go
  • go/engine/metal/rwkv7_backend_test.go
  • go/engine/metal/rwkv7_device_parity_test.go
  • go/engine/metal/rwkv7_real_checkpoint_device_test.go
  • go/engine/metal/sdpa.go
  • go/engine/metal/sdpa_prompt_gemm.go
  • go/engine/metal/sdpa_rtdim.go
  • go/engine/metal/sdpa_rtdim_test.go
  • go/engine/metal/sdpa_sinks.go
  • go/engine/metal/sdpa_sinks_test.go
  • go/engine/metal/sdpa_vector_q8.go
  • go/engine/metal/sdpa_vector_tq.go
  • go/engine/metal/sdpa_vector_tq_test.go
  • go/engine/metal/session_chat_template_test.go
  • go/engine/metal/session_kvconv_test.go
  • go/engine/metal/session_name_guard_test.go
  • go/engine/metal/session_prompt_reuse.go
  • go/engine/metal/session_prompt_reuse_q8_test.go
  • go/engine/metal/session_state_blocks.go
  • go/engine/metal/session_state_tq.go
  • go/engine/metal/session_state_tq_test.go
  • go/engine/metal/speculative_model.go
  • go/engine/metal/spike_e2b_bench_test.go
  • go/engine/metal/stateful_session_test.go
  • go/engine/metal/test_helpers_test.go
  • go/engine/metal/testdata/e2b_mirror_oracle.py
  • go/engine/metal/testdata/e2b_mlx_reference.py
  • go/engine/metal/token_model.go
  • go/engine/metal/token_model_test.go
  • go/engine/metal/tq_kv_mode.go
  • go/engine/metal/tq_kv_mode_test.go
  • go/engine/metal/tq_kv_state.go
  • go/engine/metal/tq_live_e2e_test.go
  • go/engine/metal/train_backward.go
  • go/engine/metal/train_e2b_capture_vs_oracle_test.go
  • go/engine/metal/train_e2b_shared_sft_test.go
  • go/engine/metal/train_e2b_sublayer_probe_test.go
  • go/engine/metal/train_lora_layer.go
  • go/engine/metal/train_lora_layer_example_test.go
  • go/engine/metal/train_lora_layer_test.go
  • go/engine/metal/train_real_globals_probe_test.go
  • go/engine/metal/train_real_layer.go
  • go/engine/metal/train_real_layer_example_test.go
  • go/engine/metal/train_real_layer_test.go
  • go/engine/metal/train_real_shared.go
  • go/engine/metal/train_real_shared_test.go
  • go/engine/metal/train_session.go
  • go/engine/metal/train_session_test.go
  • go/engine/metal/train_softcap.go
  • go/engine/metal/train_softcap_test.go
  • go/engine/metal/train_trainer.go
  • go/engine/metal/train_trainer_layers.go
  • go/engine/metal/train_trainer_layers_test.go
  • go/engine/metal/train_trainer_mask_test.go
  • go/engine/metal/train_trainer_target_test.go
  • go/engine/metal/turboquant_capture_tap.go
  • go/engine/metal/turboquant_capture_tap_example_test.go
  • go/engine/metal/turboquant_capture_tap_test.go
  • go/engine/metal/turboquant_device.go
  • go/engine/metal/turboquant_device_test.go
  • go/engine/metal/turboquant_real_kv_capture_test.go
  • go/engine/metal/vision.go
  • go/engine/metal/vision_features.go
  • go/engine/metal/vision_helpers_test.go
  • go/engine/metal/zz_cover_inputs_test.go
  • go/engine/metal/zz_cover_wronglib_test.go
  • go/engine/model.go
  • go/engine/model_test.go
  • go/engine/prompt_reuse_test.go
  • go/engine/scheme/builtin.go
  • go/engine/scheme/builtin_test.go
  • go/engine/session.go
  • go/engine/session_test.go
  • go/engine/vision.go
  • go/engine/vision_test.go
  • go/eval/bench/matrix.go
  • go/eval/bench/matrix_test.go
  • go/eval/classify/classify.go
  • go/eval/classify/validate.go
  • go/eval/datapipe/db.go
  • go/eval/datapipe/helpers.go
  • go/eval/datapipe/influx.go
  • go/eval/datapipe/ingest.go
  • go/eval/datapipe/lql.go
  • go/eval/datapipe/lql_example_test.go
  • go/eval/datapipe/lql_test.go
  • go/eval/datapipe/parquet.go
  • go/eval/eval_example_test.go
  • go/eval/experiments/runner.go
  • go/eval/score/helpers.go
  • go/eval/score/judge.go
  • go/gguf.go
  • go/go.mod
  • go/inference.go
  • go/internal/enginegate/hfmodel.go
  • go/kv/blockcache/blockcache.go
  • go/kv/blocks.go
  • go/kv/snapshot_decode.go
  • go/kv/state_store.go
  • go/kv/turboquant/bits.go
  • go/kv/turboquant/bits_test.go
  • go/kv/turboquant/codec.go
  • go/kv/turboquant/codec_test.go
  • go/kv/turboquant/density.go
  • go/kv/turboquant/density_test.go
  • go/kv/turboquant/doc.go
  • go/kv/turboquant/export.go
  • go/kv/turboquant/export_test.go
  • go/kv/turboquant/groupquant.go
  • go/kv/turboquant/groupquant_test.go
  • go/kv/turboquant/instrument.go
  • go/kv/turboquant/instrument_test.go
  • go/kv/turboquant/lloydmax.go
  • go/kv/turboquant/lloydmax_test.go
  • go/kv/turboquant/matrix.go
  • go/kv/turboquant/matrix_test.go
  • go/kv/turboquant/mixed.go
  • go/kv/turboquant/mixed_test.go
  • go/kv/turboquant/qmse.go
  • go/kv/turboquant/qmse_test.go
  • go/kv/turboquant/qprod.go
  • go/kv/turboquant/qprod_test.go
  • go/kv/turboquant/real.go
  • go/kv/turboquant/real_test.go
  • go/kv/turboquant/vecmath.go
  • go/kv/turboquant/vecmath_test.go
  • go/kv/turboquant/wire.go
  • go/kv/turboquant/wire_test.go
  • go/model/arch.go
  • go/model/arch/CohereForAI/cohere/config.go
  • go/model/arch/CohereForAI/cohere/config_bench_test.go
  • go/model/arch/CohereForAI/cohere/config_example_test.go
  • go/model/arch/CohereForAI/cohere/config_test.go
  • go/model/arch/CohereForAI/cohere/register.go
  • go/model/arch/CohereForAI/cohere/register_test.go
  • go/model/arch/CohereForAI/cohere/testdata/CohereLabs-c4ai-command-r-v01-config.json
  • go/model/arch/CohereForAI/cohere/testdata/CohereLabs-c4ai-command-r-v01-model.safetensors.index.json
  • go/model/arch/CohereForAI/cohere/testdata/CohereLabs-c4ai-command-r7b-12-2024-config.json
  • go/model/arch/CohereForAI/cohere/testdata/CohereLabs-c4ai-command-r7b-12-2024-model.safetensors.index.json
  • go/model/arch/HuggingFaceTB/smollm3/config.go
  • go/model/arch/HuggingFaceTB/smollm3/config_bench_test.go
  • go/model/arch/HuggingFaceTB/smollm3/config_example_test.go
  • go/model/arch/HuggingFaceTB/smollm3/config_test.go
  • go/model/arch/HuggingFaceTB/smollm3/register.go
  • go/model/arch/HuggingFaceTB/smollm3/testdata/huggingface-smollm3-config.json
  • go/model/arch/HuggingFaceTB/smollm3/testdata/huggingface-smollm3-index-receipt.json
  • go/model/arch/LGAI-EXAONE/exaone4/exaone4.go
  • go/model/arch/LGAI-EXAONE/exaone4/exaone4_bench_test.go
  • go/model/arch/LGAI-EXAONE/exaone4/exaone4_example_test.go
  • go/model/arch/LGAI-EXAONE/exaone4/exaone4_test.go
  • go/model/arch/LGAI-EXAONE/exaone4/testdata/LGAI-EXAONE-EXAONE-4.0-32B-config.json
  • go/model/arch/LGAI-EXAONE/exaone4/testdata/LGAI-EXAONE-EXAONE-4.0-32B-model.safetensors.index.json
  • go/model/arch/Qwen/qwen2/config.go
  • go/model/arch/Qwen/qwen2/config_bench_test.go
  • go/model/arch/Qwen/qwen2/config_example_test.go
  • go/model/arch/Qwen/qwen2/config_test.go
  • go/model/arch/Qwen/qwen2/real_checkpoint_test.go
  • go/model/arch/Qwen/qwen2/register.go
  • go/model/arch/Qwen/qwen2/register_test.go
  • go/model/arch/Qwen/qwen2/testdata/qwen-qwen2-0.5b-config.json
  • go/model/arch/Qwen/qwen2/testdata/qwen-qwen2.5-0.5b-config.json
  • go/model/arch/Qwen/qwen2/testdata/qwen-qwen2.5-7b-model.safetensors.index.json
  • go/model/arch/Qwen/qwen3/gguf/register.go
  • go/model/arch/Qwen/qwen3/gguf/register_test.go
  • go/model/arch/Qwen/qwen3/qwen3.go
  • go/model/arch/Qwen/qwen3/qwen3_bench_test.go
  • go/model/arch/Qwen/qwen3/qwen3_example_test.go
  • go/model/arch/Qwen/qwen3/qwen3_test.go
  • go/model/arch/Qwen/qwen3/register.go
  • go/model/arch/Qwen/qwen3/register_bench_test.go
  • go/model/arch/Qwen/qwen35/dialect.go
  • go/model/arch/Qwen/qwen35/dialect_test.go
  • go/model/arch/Qwen/qwen35/mtp_drafter.go
  • go/model/arch/Qwen/qwen35/mtp_drafter_real_test.go
  • go/model/arch/Qwen/qwen35/mtp_drafter_test.go
  • go/model/arch/Qwen/qwen35/qwen35.go
  • go/model/arch/Qwen/qwen35/qwen35_test.go
  • go/model/arch/Qwen/qwen35/register.go
  • go/model/arch/Qwen/qwen35/register_test.go
  • go/model/arch/Qwen/qwen35/vision.go
  • go/model/arch/Qwen/qwen35/vision_loader.go
  • go/model/arch/Qwen/qwen35/vision_loader_test.go
  • go/model/arch/Qwen/qwen35/vision_preprocess.go
  • go/model/arch/Qwen/qwen35/vision_preprocess_test.go
  • go/model/arch/Qwen/qwen35/vision_real_test.go
  • go/model/arch/Qwen/qwen35/vision_test.go
  • go/model/arch/Qwen/qwen35/weights.go
  • go/model/arch/Qwen/qwen35/weights_test.go
  • go/model/arch/Qwen/qwenmoe/load_test.go
  • go/model/arch/Qwen/qwenmoe/qwenmoe.go
  • go/model/arch/Qwen/qwenmoe/qwenmoe_bench_test.go
  • go/model/arch/Qwen/qwenmoe/qwenmoe_example_test.go
  • go/model/arch/Qwen/qwenmoe/qwenmoe_test.go
  • go/model/arch/Qwen/qwenmoe/register.go
  • go/model/arch/Qwen/qwenmoe/register_test.go
  • go/model/arch/Qwen/qwenmoe/testdata/Qwen-Qwen1.5-MoE-A2.7B-config.json
  • go/model/arch/Qwen/qwenmoe/testdata/Qwen-Qwen1.5-MoE-A2.7B-model.safetensors.index.json
  • go/model/arch/Qwen/qwenmoe/testdata/Qwen-Qwen3-30B-A3B-config.json
  • go/model/arch/Qwen/qwenmoe/testdata/Qwen-Qwen3-30B-A3B-model.safetensors.index.json
  • go/model/arch/Qwen/qwenmoe/weights.go
  • go/model/arch/Qwen/qwenmoe/weights_test.go
  • go/model/arch/allenai/olmo/config.go
  • go/model/arch/allenai/olmo/config_bench_test.go
  • go/model/arch/allenai/olmo/config_example_test.go
  • go/model/arch/allenai/olmo/config_test.go
  • go/model/arch/allenai/olmo/integration_test.go
  • go/model/arch/allenai/olmo/register.go
  • go/model/arch/allenai/olmo/register_test.go
  • go/model/arch/allenai/olmo/testdata/allenai-olmo-1b-hf-config.json
  • go/model/arch/allenai/olmo/testdata/allenai-olmo-2-0425-1b-config.json
  • go/model/arch/allenai/olmo/testdata/allenai-olmo-2-1124-7b-model.safetensors.index.json
  • go/model/arch/allenai/olmo/testdata/allenai-olmo-7b-0724-hf-model.safetensors.index.json
  • go/model/arch/allenai/olmoe/config.go
  • go/model/arch/allenai/olmoe/config_bench_test.go
  • go/model/arch/allenai/olmoe/config_example_test.go
  • go/model/arch/allenai/olmoe/config_test.go
  • go/model/arch/allenai/olmoe/load_test.go
  • go/model/arch/allenai/olmoe/register.go
  • go/model/arch/allenai/olmoe/register_test.go
  • go/model/arch/allenai/olmoe/testdata/allenai-olmoe-1b-7b-0924-config.json
  • go/model/arch/allenai/olmoe/testdata/allenai-olmoe-1b-7b-0924-model.safetensors.index.json
  • go/model/arch/allenai/olmoe/weights.go
  • go/model/arch/allenai/olmoe/weights_test.go
  • go/model/arch/baidu/ernie45/ernie45.go
  • go/model/arch/baidu/ernie45/ernie45_bench_test.go
  • go/model/arch/baidu/ernie45/ernie45_example_test.go
  • go/model/arch/baidu/ernie45/ernie45_test.go
  • go/model/arch/baidu/ernie45/testdata/baidu-ERNIE-4.5-0.3B-PT-config.json
  • go/model/arch/baidu/ernie45/testdata/mlx-community-ERNIE-4.5-0.3B-PT-bf16-model.safetensors.index.json
  • go/model/arch/bert/config.go
  • go/model/arch/bert/config_example_test.go
  • go/model/arch/bert/config_test.go
  • go/model/arch/bert/encoder.go
  • go/model/arch/bert/encoder_bench_test.go
  • go/model/arch/bert/encoder_test.go
  • go/model/arch/bert/model.go
  • go/model/arch/bert/model_bench_test.go
  • go/model/arch/bert/model_example_test.go
  • go/model/arch/bert/model_test.go
  • go/model/arch/bert/parity_test.go
  • go/model/arch/bert/pooling.go
  • go/model/arch/bert/pooling_test.go
  • go/model/arch/bert/serve_model.go
  • go/model/arch/bert/serve_model_example_test.go
  • go/model/arch/bert/serve_model_test.go
  • go/model/arch/bert/testdata/bge_small_reference.json
  • go/model/arch/bert/testdata/dump_cross_encoder_reference.py
  • go/model/arch/bert/testdata/dump_reference.py
  • go/model/arch/bert/testdata/ms_marco_cross_encoder_reference.json
  • go/model/arch/bert/tokenizer.go
  • go/model/arch/bert/tokenizer_bench_test.go
  • go/model/arch/bert/tokenizer_example_test.go
  • go/model/arch/bert/tokenizer_test.go
  • go/model/arch/bert/weights.go
  • go/model/arch/bigcode/starcoder2/config.go
  • go/model/arch/bigcode/starcoder2/config_bench_test.go
  • go/model/arch/bigcode/starcoder2/config_example_test.go
  • go/model/arch/bigcode/starcoder2/config_test.go
  • go/model/arch/bigcode/starcoder2/register.go
  • go/model/arch/bigcode/starcoder2/register_test.go
  • go/model/arch/bigcode/starcoder2/testdata/bigcode-starcoder2-3b-config.json
  • go/model/arch/bigcode/starcoder2/testdata/bigcode-starcoder2-7b-model.safetensors.index.json
  • go/model/arch/bigcode/starcoder2/testdata/salesforce-codegen-350m-mono-config.json
  • go/model/arch/bloom/config.go
  • go/model/arch/bloom/config_example_test.go
  • go/model/arch/bloom/config_test.go
  • go/model/arch/bloom/register.go
  • go/model/arch/bloom/register_test.go
  • go/model/arch/databricks/dbrx/config.go
  • go/model/arch/databricks/dbrx/config_bench_test.go
  • go/model/arch/databricks/dbrx/config_example_test.go
  • go/model/arch/databricks/dbrx/config_test.go
  • go/model/arch/databricks/dbrx/load_test.go
  • go/model/arch/databricks/dbrx/register.go
  • go/model/arch/databricks/dbrx/register_example_test.go
  • go/model/arch/databricks/dbrx/register_test.go
  • go/model/arch/databricks/dbrx/weights.go
  • go/model/arch/databricks/dbrx/weights_test.go
  • go/model/arch/deepseek-ai/deepseek/config.go
  • go/model/arch/deepseek-ai/deepseek/config_example_test.go
  • go/model/arch/deepseek-ai/deepseek/config_test.go
  • go/model/arch/deepseek-ai/deepseek/register.go
  • go/model/arch/deepseek-ai/deepseek/register_example_test.go
  • go/model/arch/deepseek-ai/deepseek/register_test.go
  • go/model/arch/deepseek-ai/deepseek/testdata/deepseek-ai-deepseek-v2-lite-config.json
  • go/model/arch/deepseek-ai/deepseekvl2/config.go
  • go/model/arch/deepseek-ai/deepseekvl2/config_example_test.go
  • go/model/arch/deepseek-ai/deepseekvl2/config_test.go
  • go/model/arch/deepseek-ai/deepseekvl2/decoder.go
  • go/model/arch/deepseek-ai/deepseekvl2/decoder_test.go
  • go/model/arch/deepseek-ai/deepseekvl2/golden_test.go
  • go/model/arch/deepseek-ai/deepseekvl2/live_test.go
  • go/model/arch/deepseek-ai/deepseekvl2/mathops.go
  • go/model/arch/deepseek-ai/deepseekvl2/ocr.go
  • go/model/arch/deepseek-ai/deepseekvl2/ocr_example_test.go
  • go/model/arch/deepseek-ai/deepseekvl2/ocr_test.go
  • go/model/arch/deepseek-ai/deepseekvl2/register.go
  • go/model/arch/deepseek-ai/deepseekvl2/register_test.go
  • go/model/arch/deepseek-ai/deepseekvl2/testdata/decoder_toy_golden.json
  • go/model/arch/deepseek-ai/deepseekvl2/testdata/e2e_golden.json
  • go/model/arch/deepseek-ai/deepseekvl2/testdata/e2e_vision_golden.json
  • go/model/arch/deepseek-ai/deepseekvl2/testdata/gen_fixture.py
  • go/model/arch/deepseek-ai/deepseekvl2/testdata/moe_gate_real_golden.json
  • go/model/arch/deepseek-ai/deepseekvl2/testdata/vision_toy_golden.json
  • go/model/arch/deepseek-ai/deepseekvl2/tokens.go
  • go/model/arch/deepseek-ai/deepseekvl2/tokens_test.go
  • go/model/arch/deepseek-ai/deepseekvl2/vision.go
  • go/model/arch/deepseek-ai/deepseekvl2/vision_clip.go
  • go/model/arch/deepseek-ai/deepseekvl2/vision_clip_test.go
  • go/model/arch/deepseek-ai/deepseekvl2/vision_example_test.go
  • go/model/arch/deepseek-ai/deepseekvl2/vision_sam.go
  • go/model/arch/deepseek-ai/deepseekvl2/vision_sam_test.go
  • go/model/arch/deepseek-ai/deepseekvl2/vision_test.go
  • go/model/arch/deepseek-ai/deepseekvl2/weights.go
  • go/model/arch/deepseek-ai/deepseekvl2/weights_clip.go
  • go/model/arch/deepseek-ai/deepseekvl2/weights_decoder.go
  • go/model/arch/deepseek-ai/deepseekvl2/weights_sam.go
  • go/model/arch/deepseek-ai/deepseekvl2/weights_test.go
  • go/model/arch/deltanet/deltanet.go
  • go/model/arch/deltanet/deltanet_bench_test.go
  • go/model/arch/deltanet/deltanet_example_test.go
  • go/model/arch/deltanet/deltanet_test.go
  • go/model/arch/deltanet/hf_cross_test.go
  • go/model/arch/google/gemma3/gemma3.go
  • go/model/arch/google/gemma3/gemma3_bench_test.go
  • go/model/arch/google/gemma3/gemma3_example_test.go
  • go/model/arch/google/gemma3/gemma3_test.go
  • go/model/arch/google/gemma3/gguf/convert.go
  • go/model/arch/google/gemma3/gguf/convert_test.go
  • go/model/arch/google/gemma3/gguf/metadata.go
  • go/model/arch/google/gemma3/gguf/metadata_test.go
  • go/model/arch/google/gemma3/gguf/names.go
  • go/model/arch/google/gemma3/gguf/names_example_test.go
  • go/model/arch/google/gemma3/gguf/names_test.go
  • go/model/arch/google/gemma3/gguf/register.go
  • go/model/arch/google/gemma3/gguf/tokenizer.go
  • go/model/arch/google/gemma3/gguf/tokenizer_test.go
  • go/model/arch/google/gemma3/gguf/types.go
  • go/model/arch/google/gemma3/gguf/types_test.go
  • go/model/arch/google/gemma3/register.go
  • go/model/arch/gpt2/config.go
  • go/model/arch/gpt2/config_example_test.go
  • go/model/arch/gpt2/config_test.go
  • go/model/arch/gpt2/parity_test.go
  • go/model/arch/gpt2/register.go
  • go/model/arch/gpt2/weights.go
  • go/model/arch/gpt2/weights_example_test.go
  • go/model/arch/gpt2/weights_test.go
  • go/model/arch/gptneox/config.go
  • go/model/arch/gptneox/config_bench_test.go
  • go/model/arch/gptneox/config_example_test.go
  • go/model/arch/gptneox/config_test.go
  • go/model/arch/gptneox/register.go
  • go/model/arch/gptneox/register_example_test.go
  • go/model/arch/gptneox/register_test.go
  • go/model/arch/ibm-granite/granite/config.go
  • go/model/arch/ibm-granite/granite/config_bench_test.go
  • go/model/arch/ibm-granite/granite/config_example_test.go
  • go/model/arch/ibm-granite/granite/config_test.go
  • go/model/arch/ibm-granite/granite/register.go
  • go/model/arch/ibm-granite/granite/register_test.go
  • go/model/arch/ibm-granite/granite/testdata/ibm-granite-granite-3.3-2b-base-config.json
  • go/model/arch/ibm-granite/granite/testdata/ibm-granite-granite-3.3-2b-base-model.safetensors.index.json
  • go/model/arch/ibm-granite/granitemoe/config.go
  • go/model/arch/ibm-granite/granitemoe/config_bench_test.go
  • go/model/arch/ibm-granite/granitemoe/config_example_test.go
  • go/model/arch/ibm-granite/granitemoe/config_test.go
  • go/model/arch/ibm-granite/granitemoe/load_test.go
  • go/model/arch/ibm-granite/granitemoe/register.go
  • go/model/arch/ibm-granite/granitemoe/register_example_test.go
  • go/model/arch/ibm-granite/granitemoe/register_test.go
  • go/model/arch/ibm-granite/granitemoe/testdata/ibm-granite-granite-3.1-1b-a400m-base-config.json
  • go/model/arch/ibm-granite/granitemoe/testdata/ibm-granite-granite-3.1-1b-a400m-base-model.safetensors.index.json
  • go/model/arch/ibm-granite/granitemoe/weights.go
  • go/model/arch/ibm-granite/granitemoe/weights_test.go
  • go/model/arch/jetmoe/MOA_GAP.md
  • go/model/arch/jetmoe/config.go
  • go/model/arch/jetmoe/config_bench_test.go
  • go/model/arch/jetmoe/config_example_test.go
  • go/model/arch/jetmoe/config_test.go
  • go/model/arch/jetmoe/register.go
  • go/model/arch/jetmoe/register_example_test.go
  • go/model/arch/jetmoe/register_test.go
  • go/model/arch/jetmoe/testdata/jetmoe-jetmoe-8b-config.json
  • go/model/arch/jetmoe/testdata/jetmoe-jetmoe-8b-model.safetensors.index.json
  • go/model/arch/jetmoe/weights.go
  • go/model/arch/jetmoe/weights_test.go
  • go/model/arch/mamba2/backend.go
  • go/model/arch/mamba2/backend_bench_test.go
  • go/model/arch/mamba2/block.go
  • go/model/arch/mamba2/block_bench_test.go
  • go/model/arch/mamba2/block_example_test.go
  • go/model/arch/mamba2/block_test.go
  • go/model/arch/mamba2/conv.go
  • go/model/arch/mamba2/conv_bench_test.go
  • go/model/arch/mamba2/conv_example_test.go
  • go/model/arch/mamba2/conv_test.go
  • go/model/arch/mamba2/loader.go
  • go/model/arch/mamba2/loader_bench_test.go
  • go/model/arch/mamba2/loader_example_test.go
  • go/model/arch/mamba2/loader_test.go
  • go/model/arch/mamba2/model.go
  • go/model/arch/mamba2/model_bench_test.go
  • go/model/arch/mamba2/model_example_test.go
  • go/model/arch/mamba2/model_test.go
  • go/model/arch/mamba2/scan.go
  • go/model/arch/mamba2/scan_bench_test.go
  • go/model/arch/mamba2/scan_example_test.go
  • go/model/arch/mamba2/scan_test.go
  • go/model/arch/mamba2/smoke_test.go
  • go/model/arch/mamba2/token_model.go
  • go/model/arch/mamba2/token_model_bench_test.go
  • go/model/arch/mamba2/token_model_example_test.go
  • go/model/arch/mamba2/token_model_test.go
  • go/model/arch/meta-llama/llama/config.go
  • go/model/arch/meta-llama/llama/config_bench_test.go
  • go/model/arch/meta-llama/llama/config_example_test.go
  • go/model/arch/meta-llama/llama/config_test.go
  • go/model/arch/meta-llama/llama/gguf/convert.go
  • go/model/arch/meta-llama/llama/gguf/convert_test.go
  • go/model/arch/meta-llama/llama/gguf/metadata.go
  • go/model/arch/meta-llama/llama/gguf/metadata_test.go
  • go/model/arch/meta-llama/llama/gguf/names.go
  • go/model/arch/meta-llama/llama/gguf/names_test.go
  • go/model/arch/meta-llama/llama/gguf/register.go
  • go/model/arch/meta-llama/llama/gguf/tokenizer.go
  • go/model/arch/meta-llama/llama/gguf/types.go
  • go/model/arch/meta-llama/llama/gguf/types_test.go
  • go/model/arch/meta-llama/llama/register.go
  • go/model/arch/meta-llama/llama/register_test.go
  • go/model/arch/meta-llama/llama/testdata/meta-llama-llama-3.1-8b-config.json
  • go/model/arch/meta-llama/llama/testdata/meta-llama-llama-3.2-1b-config.json
  • go/model/arch/meta-llama/llama4/config.go
  • go/model/arch/meta-llama/llama4/config_example_test.go
  • go/model/arch/meta-llama/llama4/config_test.go
  • go/model/arch/meta-llama/llama4/load_test.go
  • go/model/arch/meta-llama/llama4/register.go
  • go/model/arch/meta-llama/llama4/register_example_test.go
  • go/model/arch/meta-llama/llama4/register_test.go
  • go/model/arch/meta-llama/llama4/testdata/meta-llama-llama-4-scout-17b-16e-instruct-config.json
  • go/model/arch/meta-llama/llama4/testdata/meta-llama-llama-4-scout-17b-16e-instruct-model-index-excerpt.json
  • go/model/arch/meta-llama/llama4/weights.go
  • go/model/arch/meta-llama/llama4/weights_test.go
  • go/model/arch/microsoft/phi/config.go
  • go/model/arch/microsoft/phi/config_example_test.go
  • go/model/arch/microsoft/phi/config_test.go
  • go/model/arch/microsoft/phi/gguf/register.go
  • go/model/arch/microsoft/phi/gguf/register_test.go
  • go/model/arch/microsoft/phi/register.go
  • go/model/arch/microsoft/phi/register_example_test.go
  • go/model/arch/microsoft/phi/register_test.go
  • go/model/arch/microsoft/phi/testdata/microsoft-phi-2-config.json
  • go/model/arch/microsoft/phi/testdata/microsoft-phi-2-model.safetensors.index.json
  • go/model/arch/microsoft/phi/testdata/microsoft-phi-3-mini-128k-instruct-config.json
  • go/model/arch/microsoft/phi/testdata/microsoft-phi-3-mini-4k-instruct-config.json
  • go/model/arch/microsoft/phi/testdata/microsoft-phi-3-mini-4k-instruct-model.safetensors.index.json
  • go/model/arch/mistralai/mistral/config.go
  • go/model/arch/mistralai/mistral/config_bench_test.go
  • go/model/arch/mistralai/mistral/config_example_test.go
  • go/model/arch/mistralai/mistral/config_test.go
  • go/model/arch/mistralai/mistral/gguf/register.go
  • go/model/arch/mistralai/mistral/gguf/register_test.go
  • go/model/arch/mistralai/mistral/register.go
  • go/model/arch/mistralai/mistral/register_test.go
  • go/model/arch/mistralai/mistral/yarn.go
  • go/model/arch/mistralai/mistral/yarn_branches_test.go
  • go/model/arch/mistralai/mistral/yarn_example_test.go
  • go/model/arch/mistralai/mistral/yarn_test.go
  • go/model/arch/mistralai/mixtral/config.go
  • go/model/arch/mistralai/mixtral/config_example_test.go
  • go/model/arch/mistralai/mixtral/config_test.go
  • go/model/arch/mistralai/mixtral/load_test.go
  • go/model/arch/mistralai/mixtral/register.go
  • go/model/arch/mistralai/mixtral/register_example_test.go
  • go/model/arch/mistralai/mixtral/register_test.go
  • go/model/arch/mistralai/mixtral/testdata/mistralai-mixtral-8x7b-v0.1-config.json
  • go/model/arch/mistralai/mixtral/weights.go
  • go/model/arch/mistralai/mixtral/weights_test.go
  • go/model/arch/mpt/config.go
  • go/model/arch/mpt/config_bench_test.go
  • go/model/arch/mpt/config_example_test.go
  • go/model/arch/mpt/config_test.go
  • go/model/arch/mpt/register.go
  • go/model/arch/mpt/testdata/adamrb-mpt-30b-chat-config.json
  • go/model/arch/mpt/testdata/adamrb-mpt-30b-chat-index-receipt.json
  • go/model/arch/openai/gptoss/arch_test.go
  • go/model/arch/openai/gptoss/config.go
  • go/model/arch/openai/gptoss/config_example_test.go
  • go/model/arch/openai/gptoss/config_test.go
  • go/model/arch/openai/gptoss/live_generate_test.go
  • go/model/arch/openai/gptoss/live_test.go
  • go/model/arch/openai/gptoss/register.go
  • go/model/arch/openai/gptoss/register_test.go
  • go/model/arch/openai/gptoss/testdata/openai-gpt-oss-20b-config.json
  • go/model/arch/openai/gptoss/weights.go
  • go/model/arch/openai/gptoss/weights_test.go
  • go/model/arch/openai/gptoss/yarn.go
  • go/model/arch/openai/gptoss/yarn_test.go
  • go/model/arch/openai/privacyfilter/config.go
  • go/model/arch/openai/privacyfilter/config_example_test.go
  • go/model/arch/openai/privacyfilter/config_test.go
  • go/model/arch/openai/privacyfilter/register.go
  • go/model/arch/openai/privacyfilter/register_test.go
  • go/model/arch/openai/privacyfilter/testdata/openai-privacy-filter-config.json
  • go/model/arch/openai/whisper/attention.go
  • go/model/arch/openai/whisper/attention_test.go
  • go/model/arch/openai/whisper/config.go
  • go/model/arch/openai/whisper/config_example_test.go
  • go/model/arch/openai/whisper/config_test.go
  • go/model/arch/openai/whisper/decoder.go
  • go/model/arch/openai/whisper/decoder_example_test.go
  • go/model/arch/openai/whisper/decoder_test.go
  • go/model/arch/openai/whisper/encoder.go
  • go/model/arch/openai/whisper/encoder_example_test.go
  • go/model/arch/openai/whisper/encoder_test.go
  • go/model/arch/openai/whisper/generation_config.go
  • go/model/arch/openai/whisper/generation_config_example_test.go
  • go/model/arch/openai/whisper/generation_config_test.go
  • go/model/arch/openai/whisper/golden_test.go
  • go/model/arch/openai/whisper/live_test.go
  • go/model/arch/openai/whisper/mel.go
  • go/model/arch/openai/whisper/mel_example_test.go
  • go/model/arch/openai/whisper/mel_test.go
  • go/model/arch/openai/whisper/register.go
  • go/model/arch/openai/whisper/register_test.go
  • go/model/arch/openai/whisper/testdata/e2e_golden.json
  • go/model/arch/openai/whisper/testdata/generation_config.json
  • go/model/arch/openai/whisper/testdata/mel_golden.json
  • go/model/arch/openai/whisper/testdata/openai-whisper-tiny-config.json
  • go/model/arch/openai/whisper/testdata/preprocessor_config.json
  • go/model/arch/openai/whisper/testdata/toy_block_goldens.json
  • go/model/arch/openai/whisper/tokens.go
  • go/model/arch/openai/whisper/tokens_example_test.go
  • go/model/arch/openai/whisper/tokens_test.go
  • go/model/arch/openai/whisper/transcribe.go
  • go/model/arch/openai/whisper/transcribe_example_test.go
  • go/model/arch/openai/whisper/transcribe_test.go
  • go/model/arch/openai/whisper/wav.go
  • go/model/arch/openai/whisper/wav_example_test.go
  • go/model/arch/openai/whisper/wav_test.go
  • go/model/arch/openai/whisper/weights.go
  • go/model/arch/openai/whisper/weights_example_test.go
  • go/model/arch/openai/whisper/weights_test.go
  • go/model/arch/opt/config.go
  • go/model/arch/opt/config_bench_test.go
  • go/model/arch/opt/config_example_test.go
  • go/model/arch/opt/config_test.go
  • go/model/arch/opt/parity_test.go
  • go/model/arch/opt/register.go
  • go/model/arch/opt/register_test.go
  • go/model/arch/opt/testdata/facebook-opt-1.3b-config.json
  • go/model/arch/opt/testdata/facebook-opt-125m-config.json
  • go/model/arch/opt/testdata/facebook-opt-350m-config.json
  • go/model/arch/opt/weights.go
  • go/model/arch/opt/weights_bench_test.go
  • go/model/arch/opt/weights_example_test.go
  • go/model/arch/opt/weights_test.go
  • go/model/arch/rednote-hilab/dotsocr/config.go
  • go/model/arch/rednote-hilab/dotsocr/config_example_test.go
  • go/model/arch/rednote-hilab/dotsocr/config_test.go
  • go/model/arch/rednote-hilab/dotsocr/decoder.go
  • go/model/arch/rednote-hilab/dotsocr/decoder_test.go
  • go/model/arch/rednote-hilab/dotsocr/generation_config.go
  • go/model/arch/rednote-hilab/dotsocr/golden_test.go
  • go/model/arch/rednote-hilab/dotsocr/image.go
  • go/model/arch/rednote-hilab/dotsocr/image_test.go
  • go/model/arch/rednote-hilab/dotsocr/live_test.go
  • go/model/arch/rednote-hilab/dotsocr/math.go
  • go/model/arch/rednote-hilab/dotsocr/ocr.go
  • go/model/arch/rednote-hilab/dotsocr/ocr_test.go
  • go/model/arch/rednote-hilab/dotsocr/prompt.go
  • go/model/arch/rednote-hilab/dotsocr/prompt_test.go
  • go/model/arch/rednote-hilab/dotsocr/register.go
  • go/model/arch/rednote-hilab/dotsocr/register_test.go
  • go/model/arch/rednote-hilab/dotsocr/testdata/e2e_golden.json
  • go/model/arch/rednote-hilab/dotsocr/testdata/gen_fixture.py
  • go/model/arch/rednote-hilab/dotsocr/testdata/image_preproc_golden.json
  • go/model/arch/rednote-hilab/dotsocr/testdata/prompt_golden.json
  • go/model/arch/rednote-hilab/dotsocr/testdata/smart_resize_golden.json
  • go/model/arch/rednote-hilab/dotsocr/testdata/text_layer_golden.json
  • go/model/arch/rednote-hilab/dotsocr/testdata/vision_block_golden.json
  • go/model/arch/rednote-hilab/dotsocr/vision.go
  • go/model/arch/rednote-hilab/dotsocr/vision_test.go
  • go/model/arch/rednote-hilab/dotsocr/weights.go
  • go/model/arch/rednote-hilab/dotsocr/weights_test.go
  • go/model/arch/rwkv7/backend.go
  • go/model/arch/rwkv7/backend_bench_test.go
  • go/model/arch/rwkv7/block.go
  • go/model/arch/rwkv7/block_bench_test.go
  • go/model/arch/rwkv7/block_example_test.go
  • go/model/arch/rwkv7/block_test.go
  • go/model/arch/rwkv7/channelmix.go
  • go/model/arch/rwkv7/channelmix_test.go
  • go/model/arch/rwkv7/config.go
  • go/model/arch/rwkv7/config_test.go
  • go/model/arch/rwkv7/data/rwkv_vocab_v20230424.hex
  • go/model/arch/rwkv7/loader.go
  • go/model/arch/rwkv7/loader_example_test.go
  • go/model/arch/rwkv7/loader_test.go
  • go/model/arch/rwkv7/lora.go
  • go/model/arch/rwkv7/lora_test.go
  • go/model/arch/rwkv7/model.go
  • go/model/arch/rwkv7/model_example_test.go
  • go/model/arch/rwkv7/model_test.go
  • go/model/arch/rwkv7/norm.go
  • go/model/arch/rwkv7/norm_test.go
  • go/model/arch/rwkv7/real_checkpoint_test.go
  • go/model/arch/rwkv7/recurrence.go
  • go/model/arch/rwkv7/recurrence_bench_test.go
  • go/model/arch/rwkv7/recurrence_example_test.go
  • go/model/arch/rwkv7/recurrence_test.go
  • go/model/arch/rwkv7/testdata/oracle_fixture.json
  • go/model/arch/rwkv7/testdata/oracle_rwkv7.py
  • go/model/arch/rwkv7/timemix.go
  • go/model/arch/rwkv7/timemix_test.go
  • go/model/arch/rwkv7/token_model.go
  • go/model/arch/rwkv7/token_model_example_test.go
  • go/model/arch/rwkv7/token_model_test.go
  • go/model/arch/rwkv7/tokenizer.go
  • go/model/arch/rwkv7/tokenizer_example_test.go
  • go/model/arch/rwkv7/tokenizer_test.go
  • go/model/arch/stabilityai/stablelm/config.go
  • go/model/arch/stabilityai/stablelm/config_bench_test.go
  • go/model/arch/stabilityai/stablelm/config_example_test.go
  • go/model/arch/stabilityai/stablelm/config_test.go
  • go/model/arch/stabilityai/stablelm/register.go
  • go/model/arch/stabilityai/stablelm/testdata/stabilityai-stablelm-2-12b-config.json
  • go/model/arch/stabilityai/stablelm/testdata/stabilityai-stablelm-2-12b-index-receipt.json
  • go/model/arch/tencent/hunyuan/hunyuan.go
  • go/model/arch/tencent/hunyuan/hunyuan_bench_test.go
  • go/model/arch/tencent/hunyuan/hunyuan_example_test.go
  • go/model/arch/tencent/hunyuan/hunyuan_test.go
  • go/model/arch/tencent/hunyuan/testdata/tencent-Hunyuan-7B-Instruct-config.json
  • go/model/arch/tencent/hunyuan/testdata/tencent-Hunyuan-7B-Instruct-model.safetensors.index.json
  • go/model/arch/tiiuae/falcon/config.go
  • go/model/arch/tiiuae/falcon/config_example_test.go
  • go/model/arch/tiiuae/falcon/config_test.go
  • go/model/arch/tiiuae/falcon/register.go
  • go/model/arch/tiiuae/falcon/register_test.go
  • go/model/arch/z-lab/dflash/dflash.go
  • go/model/arch/z-lab/dflash/dflash_example_test.go
  • go/model/arch/z-lab/dflash/dflash_test.go
  • go/model/arch/zai-org/glm4/glm4.go
  • go/model/arch/zai-org/glm4/glm4_bench_test.go
  • go/model/arch/zai-org/glm4/glm4_example_test.go
  • go/model/arch/zai-org/glm4/glm4_test.go
  • go/model/arch/zai-org/glm4/testdata/zai-org-GLM-4-9B-0414-config.json
  • go/model/arch/zai-org/glm4/testdata/zai-org-GLM-4-9B-0414-model.safetensors.index.json
  • go/model/arch/zai-org/glmocr/config.go
  • go/model/arch/zai-org/glmocr/config_example_test.go
  • go/model/arch/zai-org/glmocr/config_test.go
  • go/model/arch/zai-org/glmocr/golden_test.go
  • go/model/arch/zai-org/glmocr/image.go
  • go/model/arch/zai-org/glmocr/image_example_test.go
  • go/model/arch/zai-org/glmocr/image_test.go
  • go/model/arch/zai-org/glmocr/live_test.go
  • go/model/arch/zai-org/glmocr/ocr.go
  • go/model/arch/zai-org/glmocr/ocr_example_test.go
  • go/model/arch/zai-org/glmocr/ocr_test.go
  • go/model/arch/zai-org/glmocr/primitives.go
  • go/model/arch/zai-org/glmocr/primitives_test.go
  • go/model/arch/zai-org/glmocr/prompt.go
  • go/model/arch/zai-org/glmocr/prompt_example_test.go
  • go/model/arch/zai-org/glmocr/prompt_test.go
  • go/model/arch/zai-org/glmocr/register.go
  • go/model/arch/zai-org/glmocr/register_test.go
  • go/model/arch/zai-org/glmocr/rope.go
  • go/model/arch/zai-org/glmocr/rope_test.go
  • go/model/arch/zai-org/glmocr/testdata/block_goldens.json
  • go/model/arch/zai-org/glmocr/testdata/e2e_golden.json
  • go/model/arch/zai-org/glmocr/testdata/gen_fixture.py
  • go/model/arch/zai-org/glmocr/textdecoder.go
  • go/model/arch/zai-org/glmocr/textdecoder_example_test.go
  • go/model/arch/zai-org/glmocr/textdecoder_test.go
  • go/model/arch/zai-org/glmocr/vision.go
  • go/model/arch/zai-org/glmocr/vision_example_test.go
  • go/model/arch/zai-org/glmocr/vision_test.go
  • go/model/arch/zai-org/glmocr/weights.go
  • go/model/arch/zai-org/glmocr/weights_example_test.go
  • go/model/arch/zai-org/glmocr/weights_test.go
  • go/model/arch_spec.go
  • go/model/arch_test.go
  • go/model/assemble.go
  • go/model/assemble_gated_delta.go
  • go/model/assemble_gated_delta_test.go
  • go/model/assemble_moe_shared_test.go
  • go/model/assemble_test.go
  • go/model/attn/gated_delta.go
  • go/model/attn/gated_delta_bench_test.go
  • go/model/attn/gated_delta_example_test.go
  • go/model/attn/gated_delta_test.go
  • go/model/bert/serve_test.go
  • go/model/bf16_weight.go
  • go/model/bloom/config_test.go
  • go/model/builtin/builtin.go
  • go/model/builtin/builtin_test.go
  • go/model/bundle/bundle.go
  • go/model/cohere/integration_test.go
  • go/model/composed/attention.go
  • go/model/composed/attention_bench_test.go
  • go/model/composed/attention_test.go
  • go/model/composed/chat_test.go
  • go/model/composed/composed.go
  • go/model/composed/composed_bench_test.go
  • go/model/composed/composed_quant_test.go
  • go/model/composed/composed_test.go
  • go/model/composed/config.go
  • go/model/composed/config_test.go
  • go/model/composed/loader.go
  • go/model/composed/loader_bench_test.go
  • go/model/composed/loader_test.go
  • go/model/composed/mamba2.go
  • go/model/composed/mamba2_test.go
  • go/model/composed/mixers.go
  • go/model/composed/mixers_bench_test.go
  • go/model/composed/moe.go
  • go/model/composed/moe_bench_test.go
  • go/model/composed/moe_test.go
  • go/model/composed/prefill_test.go
  • go/model/composed/register.go
  • go/model/composed/register_test.go
  • go/model/composed/rotary.go
  • go/model/composed/rotary_bench_test.go
  • go/model/composed/rotary_test.go
  • go/model/composed/rwkv7.go
  • go/model/composed/rwkv7_test.go
  • go/model/composed/token_model.go
  • go/model/composed/token_model_bench_test.go
  • go/model/composed/token_model_test.go
  • go/model/conformance/conformance_test.go
  • go/model/dbrx/integration_test.go
  • go/model/deepseek/config_test.go
  • go/model/deepseek/register_test.go
  • go/model/ernie45/ernie45_example_test.go
  • go/model/ernie45/ernie45_test.go
  • go/model/exaone4/exaone4_example_test.go
  • go/model/exaone4/exaone4_test.go
  • go/model/gated_delta.go
  • go/model/gemma3/gemma3_test.go
  • go/model/gemma4/audio/features.go
  • go/model/gemma4/config.go
  • go/model/gemma4/gguf/convert.go
  • go/model/gemma4/gguf/types.go
  • go/model/gemma4/load_test.go
  • go/model/gemma4/parse.go
  • go/model/gemma4/vision_assemble.go
  • go/model/gemma4/vision_assemble_test.go
  • go/model/gemma4/vision_features.go
  • go/model/gguf/info.go
  • go/model/gguf/quantize.go
  • go/model/gguf/quantize_lane_test.go
  • go/model/gguf/quantize_test.go
  • go/model/gguf/tensors_mmap_other.go
  • go/model/gguf/tensors_test.go
  • go/model/gguf/transformer_lane.go
  • go/model/glm4/glm4_example_test.go
  • go/model/glm4/glm4_test.go
  • go/model/granite/integration_test.go
  • go/model/granitemoe/integration_test.go
  • go/model/hf/hf.go
  • go/model/hf/hf_cache.go
  • go/model/hunyuan/hunyuan_example_test.go
  • go/model/hunyuan/hunyuan_test.go
  • go/model/jetmoe/MOA_GAP.md
  • go/model/jetmoe/config.go
  • go/model/jetmoe/config_example_test.go
  • go/model/jetmoe/config_test.go
  • go/model/jetmoe/integration_test.go
  • go/model/jetmoe/register.go
  • go/model/jetmoe/register_test.go
  • go/model/linear.go
  • go/model/linear_test.go
  • go/model/llama/integration_test.go
  • go/model/llama4/integration_test.go
  • go/model/load.go
  • go/model/loaded.go
  • go/model/mamba2/token_model_test.go
  • go/model/merge/compare.go
  • go/model/merge/compare_bench_test.go
  • go/model/merge/compare_test.go
  • go/model/merge/merge.go
  • go/model/merge/merge_copy.go
  • go/model/merge/merge_copy_test.go
  • go/model/merge/merge_fixtures_test.go
  • go/model/merge/merge_tensors.go
  • go/model/merge/merge_tensors_test.go
  • go/model/merge/merge_test.go
  • go/model/mixtral/integration_test.go
  • go/model/mixtral/register_test.go
  • go/model/modelmgmt/consolidate.go
  • go/model/modelmgmt/convert_test.go
  • go/model/modelmgmt/ebook_model.go
  • go/model/modelmgmt/ebook_model_test.go
  • go/model/modelmgmt/ebook_test.go
  • go/model/modelmgmt/expand_test.go
  • go/model/modelmgmt/gguf.go
  • go/model/modelmgmt/gguf_test.go
  • go/model/modelmgmt/helpers.go
  • go/model/modelmgmt/import_all_test.go
  • go/model/modelmgmt/inventory_test.go
  • go/model/modelmgmt/ollama.go
  • go/model/modelmgmt/ollama_test.go
  • go/model/modelmgmt/publish.go
  • go/model/modelmgmt/publish_test.go
  • go/model/modelmgmt/safetensors_values_test.go
  • go/model/mtp/assistant_spec.go
  • go/model/olmoe/integration_test.go
  • go/model/olmoe/register.go
  • go/model/pack/manifest.go
  • go/model/pack/pack.go
  • go/model/pack/pack_bench_test.go
  • go/model/pack/pack_example_test.go
  • go/model/pack/pack_fault_test.go
  • go/model/pack/pack_test.go
  • go/model/quant/autoround/export.go
  • go/model/quant/autoround/pack.go
  • go/model/quant/awq/snapshot.go
  • go/model/quant/codebook/codebook.go
  • go/model/quant/fp8/snapshot.go
  • go/model/quant/gptq/snapshot.go
  • go/model/quant/jang/jang.go
  • go/model/quant/mlxaffine/snapshot.go
  • go/model/quant/mxfp4/mxfp4.go
  • go/model/quant/mxfp4/mxfp4_example_test.go
  • go/model/quant/mxfp4/mxfp4_test.go
  • go/model/quant/nf4/snapshot.go
  • go/model/quant/quantfmt.go
  • go/model/quant/quantfmt_test.go
  • go/model/quant_config.go
  • go/model/quant_weight.go
  • go/model/quant_weight_example_test.go
  • go/model/quant_weight_test.go
  • go/model/qwen2/config_test.go
  • go/model/qwen2/integration_test.go
  • go/model/qwen3/gated_delta_test.go
  • go/model/qwenmoe/integration_test.go
  • go/model/qwenmoe/register.go
  • go/model/safetensors/coverage_fill_test.go
  • go/model/safetensors/index_test.go
  • go/model/safetensors/loader_test.go
  • go/model/safetensors/owned.go
  • go/model/safetensors/owned_test.go
  • go/model/safetensors/safetensors_mmap_fault_test.go
  • go/model/safetensors/safetensors_mmap_test.go
  • go/model/safetensors/safetensors_test.go
  • go/model/safetensors/sharded.go
  • go/model/safetensors/sharded_test.go
  • go/model/safetensors/values_test.go
  • go/model/safetensors/widen.go
  • go/model/safetensors/widen_example_test.go
  • go/model/safetensors/widen_test.go
  • go/model/sample.go
  • go/model/sample_test.go
  • go/model/starcoder2/integration_test.go
  • go/model/state/agent/helpers_example_test.go
  • go/model/state/artifact.go
  • go/model/token.go
  • go/model/token_resume_test.go
  • go/model/token_test.go
  • go/model/vision/vision.go
  • go/model/wrapper_names.go
  • go/model/wrapper_names_test.go
  • go/options.go
  • go/options_test.go
  • go/serving/admin/admin.go
  • go/serving/admin/admin_example_test.go
  • go/serving/admin/admin_test.go
  • go/serving/admin/models_test.go
  • go/serving/admin/reload.go
  • go/serving/admin/reload_example_test.go
  • go/serving/admin/reload_test.go
  • go/serving/admin/status_test.go
  • go/serving/api/handlers_test.go
  • go/serving/api/routes_describe_test.go
  • go/serving/api/routes_example_test.go
  • go/serving/backend_http.go
  • go/serving/chathistory/chathistory.go
  • go/serving/chathistory/export.go
  • go/serving/compat/admin.go
  • go/serving/compat/admin_test.go
  • go/serving/compat/handlers_test.go
  • go/serving/compat/mux.go
  • go/serving/continuity/share_test.go
  • go/serving/embed/embed_example_test.go
  • go/serving/fusion/fusion_example_test.go
  • go/serving/helpers.go
  • go/serving/mlservice/helpers.go
  • go/serving/pipeline/scorer.go
  • go/serving/policy/policy.go
  • go/serving/policy/schedule_test.go
  • go/serving/provider/openai/content.go
  • go/serving/provider/openai/content_test.go
  • go/serving/provider/openai/handler.go
  • go/serving/provider/openai/openai.go
  • go/serving/provider/openai/openai_bench_test.go
  • go/serving/provider/openai/request.go
  • go/serving/provider/openai/request_test.go
  • go/serving/provider/openai/tools_test.go
  • go/serving/provider/openai/transcription.go
  • go/serving/provider/openai/transcription_example_test.go
  • go/serving/provider/openai/transcription_test.go
  • go/serving/provider/openai/unmarshal.go
  • go/serving/provider/openai/unmarshal_test.go
  • go/serving/retry/classify_example_test.go
  • go/serving/retry/classify_test.go
  • go/serving/retry/retry_example_test.go
  • go/serving/scheduler/batch.go
  • go/serving/scheduler/batch_test.go
  • go/serving/scheduler/metrics_sink_test.go
  • go/serving/scheduler/scheduler.go
  • go/serving/scheduler/scheduler_test.go
  • go/serving/serve.go
  • go/serving/serve_auth.go
  • go/serving/serve_draft.go
  • go/serving/serve_draft_test.go
  • go/serving/serve_embed.go
  • go/serving/serve_multimodel_config.go
  • go/serving/serve_multimodel_profile_test.go
  • go/serving/serve_multimodel_test.go
  • go/serving/serve_profile.go
  • go/serving/serve_profile_example_test.go
  • go/serving/serve_profile_test.go
  • go/serving/serve_transcribe.go
  • go/serving/serve_transcribe_test.go
  • go/serving/structured/structured_example_test.go
  • go/serving/structured/structured_test.go
  • go/serving/transform/transform_example_test.go
  • go/serving/welfare_guard.go
  • go/serving/welfare_guard_test.go
  • go/speculative.go
  • go/speculative_example_test.go
  • go/speculative_test.go
  • go/train/capture.go
  • go/train/checkpoint/checkpoint.go
  • go/train/checkpoint/checkpoint_example_test.go
  • go/train/lora/inspect.go
  • go/train/score_cascade.go
  • go/train/sft.go
  • go/train/ssd_eval.go
  • go/train/tune/tune.go
  • go/train/tune/tune_example_test.go
  • go/train/tune/tune_test.go
  • go/welfare/detect_test.go
  • go/welfare/mediate.go
  • go/welfare/slurs/catalogue.go
  • go/welfare/slurs/slurs.go
  • go/welfare/slurs/slurs_bench_test.go
  • go/welfare/slurs/slurs_test.go
  • gui/frontend/foundations/guidelines/brand-marks.html
  • gui/frontend/foundations/guidelines/brand-textures.html
  • gui/frontend/foundations/guidelines/colors-brand-hostuk.html
  • gui/frontend/foundations/guidelines/colors-brand-lethean.html
  • gui/frontend/foundations/guidelines/colors-foreground.html
  • gui/frontend/foundations/guidelines/colors-neutrals.html
  • gui/frontend/foundations/guidelines/colors-pills-lines.html
  • gui/frontend/foundations/guidelines/colors-state.html
  • gui/frontend/foundations/guidelines/colors-warm.html
  • gui/frontend/foundations/guidelines/spacing-buttons.html
  • gui/frontend/foundations/guidelines/spacing-elevation.html
  • gui/frontend/foundations/guidelines/spacing-radii.html
  • gui/frontend/foundations/guidelines/type-body.html
  • gui/frontend/foundations/guidelines/type-display.html
  • gui/frontend/foundations/guidelines/type-editorial.html
  • gui/frontend/foundations/guidelines/type-mono.html
  • gui/frontend/src/app/chat.component.html
  • gui/frontend/src/index.html
  • gui/go.mod
  • judges/README.md
  • judges/factuality.md
  • judges/quality.md
  • judges/refusal-correctness.md

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.

Comment thread cli/tui/agentstore.go
}
store.mu.Lock()
defer store.mu.Unlock()
return scanAgentRun(store.connection.QueryRow(runSelect+" WHERE id = ?", id), "Run")
Comment thread cli/tui/agentstore.go
}
store.mu.Lock()
defer store.mu.Unlock()
runResult := scanAgentRun(store.connection.QueryRow(runSelect+" WHERE id = ?", runID), "Continuation")
Comment thread cli/tui/agentstore.go
}

func queryAgentLogs(connection *sql.DB, suffix string, arguments ...any) ([]work.LogChunk, error) {
rows, err := connection.Query("SELECT run_id, sequence, stream, text, created_at FROM agent_log_chunks "+suffix, arguments...)
pli.astype(np.float32).tofile(os.path.join(OUT, "pli.f32"))
layer_out.tofile(os.path.join(OUT, "layer_out.f32"))
attn_res.tofile(os.path.join(OUT, "attn_res.f32"))
json.dump({"ids": IDS, "T": T, "H": H, "NL": NL, "PLID": PLID}, open(os.path.join(OUT, "manifest.json"), "w"))
layer_out[li] = h
print(f"layer {li:2d} {'S' if is_sliding else 'G'}{'' if has_kv else ' shared->' + str(prev[li])}: |h| max {np.abs(h).max():.3f}")

os.makedirs(OUT, exist_ok=True)
# SDPA, scale 1.0, causal (+ sliding window), GQA broadcast kv head
o = np.zeros((T, NH, hd), dtype=np.float64)
gqa = NH // nkv
for hh in range(NH):
attn_res = np.zeros((NL, T, H), dtype=np.float32)
kv_bank = {}

for li in range(NL):
by_type = {}
for i in range(M):
by_type[LTYPES[i]] = i
for j in range(M, NL):
Comment thread cli/tui/datasetstore.go
}
s.mu.Lock()
defer s.mu.Unlock()
item, err := scanItem(s.conn().QueryRow(itemSelect+" WHERE id = ?", id))
Comment thread cli/tui/datasetstore.go
if count == 0 {
return core.Fail(datasetNotFoundErr("tui.duckDatasetStore.DatasetArchive", "dataset", id))
}
d, err := scanDataset(s.conn().QueryRow(datasetSelect+" WHERE id = ?", id))
Comment thread cli/tui/datasetstore.go
}
s.mu.Lock()
defer s.mu.Unlock()
d, err := scanDataset(s.conn().QueryRow(datasetSelect+" WHERE slug = ?", slug))
Comment thread cli/tui/datasetstore.go
}
s.mu.Lock()
defer s.mu.Unlock()
d, err := scanDataset(s.conn().QueryRow(datasetSelect+" WHERE id = ?", id))
Comment thread cli/tui/datasetstore.go
// can observe or claim the same seq value.
func (s *duckDatasetStore) nextSeqLocked(table string) (int64, error) {
var next int64
if err := s.conn().QueryRow("SELECT COALESCE(MAX(seq), 0) + 1 FROM " + table).Scan(&next); err != nil {
Comment thread cli/tui/datasetstore.go
if count == 0 {
return core.Fail(datasetNotFoundErr("tui.duckDatasetStore.ItemArchive", "item", id))
}
item, err := scanItem(s.conn().QueryRow(itemSelect+" WHERE id = ?", id))
"top5_ids": [int(i) for i in np.argsort(-logits)[:5]],
"top5_vals": [float(logits[i]) for i in np.argsort(-logits)[:5]],
}
with open(out_path, "w") as f:
v_first = None
state = [{"wkv": None, "shift1": None, "shift2": None} for _ in range(num_layers)]
captured = {}
for li in range(num_layers):

x = embed[prompt_ids]
v_first = None
state = [{"wkv": None, "shift1": None, "shift2": None} for _ in range(num_layers)]
norm_b = st.get("model.norm.bias") if st.has("model.norm.bias") else None
lm_head = st.get("lm_head.weight") if st.has("lm_head.weight") else embed

layers = [load_layer(st, li) for li in range(num_layers)]
ckpt_dir = sys.argv[1]
out_path = sys.argv[2] if len(sys.argv) > 2 else "oracle_fixture.json"

with open(ckpt_dir + "/config.json") as f:

class SafeTensors:
def __init__(self, path):
self.f = open(path, "rb")
Snider and others added 25 commits July 19, 2026 19:49
DecodeLogitsStep replaces GreedyDecode/DetectLanguage's per-step full-
sequence recompute: per decoder layer, a SelfAttnCache grows by one
batch's K/V per step (mhaCore gains an offset parameter so a cached
causal pass reproduces a whole-sequence recompute bit-for-bit — see
attention.go/decoder.go doc comments for the row-wise-independence
argument). Cross-attention Q is now projected for only the new row(s)
too. DecodeLogits (full recompute) is kept unchanged as the parity
oracle: TestDecodeLogitsStep_Good proves bit-identical logits across
fresh-single-token, multi-token-prefill, and cache-continuation call
shapes.

Receipt (live whisper-tiny, hello16k.wav, same 10-token transcript
both sides): decode loop 1.508s -> 0.385s (~3.9x, prefill+9 steps).
End-to-end Transcribe barely moves (~22.3s -> ~20.2s) because the
encoder's O(1500^2) self-attention dominates wall-clock (~18s, ~88%
of total, run-to-run noise alone ~0.9s) -- out of this lane's scope
per the design's phasing. The originally-cited "~23s" was mostly
encoder time, not decode recompute.

Co-Authored-By: Virgil <virgil@lethean.io>
The shipped MLX metallib only instantiates sdpa_vector for a fixed
class of head dims (64/96/128/256, one C++ template per width); head
dim 32 has no pipeline anywhere, and every call site's absent-width
behaviour differed (some errored immediately, some fell back to a
different kernel family that also lacked the width) — the shape
train_trainer_layers_test.go / train_trainer_mask_test.go moved to
head dim 64 specifically to dodge, per their own comments.

Adds kernels/lthn_sdpa_rtdim.metal: MLX's sdpa_vector single-pass loop
(the same body lthn_sdpa_vector_q8.metal already ports for int8 K/V)
with head_dim taken as a RUNTIME buffer parameter instead of a
template argument — one compiled kernel serves every absent width (a
positive multiple of the 32-lane simdgroup width, up to the 256
register-array cap), not just 32. Plus its 2pass_1 sibling, proven
correct in isolation (partials/sums/maxs byte-band-match the fixed
kernel's own output at head_dim=64) but NOT wired end to end: pass 2
(the merge kernel) is ALSO a per-headDim fixed-only pipeline with no
runtime-dim port, so wiring pass 1 alone would resolve a pipeline and
still fail at pass 2 — a named, honest remaining boundary rather than
a rushed, unvalidated pass-2 written without MLX's source to check
against.

sdpa_rtdim.go's sdpaVectorDispatchForHeadDim is the single chokepoint
every non-sinks, non-q8 single-pass call site now resolves through:
the fixed per-headDim pipeline when the metallib carries it
(byte-identical, untouched), or the fallback logged once per distinct
absent width — never an error, never a different fallback per site.
Wired into SDPAInto, encSDPAStrided, encSDPADecodeAt (the central
per-token decode chokepoint), attentionBlockInto, and layer.go's
decodeLayerInto. encSDPADecodeAt's 2-pass branch now falls all the way
through to the single-pass fallback when either fixed 2-pass pipeline
is unavailable, so decode at an absent head dim has no cliff at the
2-pass knee (kvLen>=1024) — correct at any length, just without the
2-pass long-context parallelism past it.

Scope: the ICB record-once/replay decode path (icb.go,
decode_forward_arch_icb.go, icb_layer.go, decode_forward_icb.go) has
its OWN separate SDPA pipeline resolver with no fallback — discovered
via TestSdpaRTDim_TrainerSessionAtHeadDim32_Good (OpenSession at
head_dim=32 fails there even with LTHN_DECODE_ICB=0, which only gates
ICB use, not the unconditional record-if-eligible at session
construction). Confirmed materially larger (4+ call sites, record/
replay semantics) and left as a named follow-up; the test forces the
non-ICB trace path via LTHN_NATIVE_TRACE=1 to prove the fix through
the real per-token decode chokepoint instead.

Gates: kernel vs host float reference at hd=32 and vs the fixed
kernel at hd=64 (cosine=1.0, worst|d|=0 across kvLen 1/17/32/65/257,
spanning the BN=32 sweep boundary) — TestSdpaRTDim_SDPA32_Good,
TestSdpaRTDim_MatchesFixedAtHeadDim64_Good. #28 repro: a synthetic
ArchSession forward at head_dim=32 (ForwardCaptureHiddens, the same
per-token StepWithID chokepoint every generate() call uses) — no
error. No cliff past the 2-pass knee at head_dim=32 —
TestEncSDPADecodeAt_HeadDim32PastTheKnee_Good. task metallib:kernels
+ task build clean; 115 sdpa-family tests green with MLX_METALLIB_PATH
set, including the full pre-existing AttentionBlock/DecodeLayer/
EncSDPADecodeAt regression set (two pre-existing, unrelated
TestAttentionBlockICB*AllocationBudget failures confirmed present on
unmodified dev — icb.go untouched by this change).

Co-Authored-By: Virgil <virgil@lethean.io>
…36 tail)

Two defects closed the standalone-recurrent serve seam:

1. metalBackend.LoadModel's post-load switch served only *NativeTokenModel
   and *composed.ComposedTokenModel; any other model.TokenModel (rwkv7's,
   mamba2's) hit the default arm's "unservable" error. Generalised the
   composed-only bridge into a third arm keyed on the neutral
   model.SessionModel interface — composedTextModel is renamed
   sessionTextModel (the old name became a lie once it also serves
   standalone-recurrent archs) and now declares ChatML for Qwen model_types
   (unchanged), a new plain-completion dialect for rwkv7/mamba2 (no bracket
   markers neither checkpoint was tuned on), and the gemma fallback
   otherwise. composedEngineSession is reused verbatim — its shape was
   already arch-neutral.

2. tokenizer.LoadTokenizer(tokenizer.json) is hardcoded and fails for rwkv7
   checkpoints (vocab .txt + custom code, no tokenizer.json). Chose option
   (a): WorldTokenizer grows DecodeToken/DecodeOne/TokenID/EOS to satisfy
   engine.TextTokenizer BY SHAPE, no import of engine (AX-8 preserved). The
   World vocab is a fixed artefact shared by the whole checkpoint family, so
   it is embedded in the binary (data/rwkv_vocab_v20230424.hex, moved out of
   testdata/ since it is now production data) rather than expected on disk —
   a real HF snapshot ships only the unparseable Python-repr .txt.
   loadServeTokenizer implements the fallback: tokenizer.json when present
   (mamba2, byte-identical), else the arch tokenizer for *rwkv7.RWKV7TokenModel,
   else the original error.

Live-caught a THIRD, pre-existing bug while proving the seam:
engine.TextModel.chatTemplate() used chatTmpl.Open == "" as its "was a
template ever resolved" sentinel, indistinguishable from a real declaration
whose Open genuinely is "" (the new plain-completion dialect) — silently
reverting to gemma's <start_of_turn> markers, which an RWKV7 checkpoint
tokenises as junk and degrades into confused, prompt-echoing continuations.
Fixed with an explicit chatTmplSet flag; regression test added.

Also added NumLayers/HiddenSize to RWKV7TokenModel/MambaTokenModel
(mirroring composed.ComposedTokenModel) so ModelInfo reports real geometry
through the generic arm, and fixed examples/pkg/rwkv7-generate's now-stale
vocab path (testdata -> data) to use the embedded tokenizer by default.

Live receipts (RWKV7-Goose-World2.8-0.1B-HF):
- examples/pkg/generate (raw TextModel.Generate, no template): "The capital
  of France is Paris.\n- The capital of the United States is Washington,
  D.C.\n- The" — matches the library-level receipt's structure exactly.
- lem generate -temp 0 / lem serve + curl (both Chat-framed via the new
  plain-completion dialect — lem generate always chat-frames despite its
  name): "A: Paris\n\nQ: ..." — correct answer, honestly non-fabricated
  framing.
- mamba2 regression: model/arch/mamba2 (70 tests) + engine/metal's mamba2
  tests all green.

Co-Authored-By: Virgil <virgil@lethean.io>
Absent head-dim widths now route to lthn_sdpa_vector_rtdim_bf16 (+ its
2pass_1 sibling, written and proven but unwired pending a pass-2 port —
the 2-pass branch falls through to single-pass, correct at any length)
through one dispatch chokepoint with a one-time notice. Byte-exact
parity: hd32 vs host reference AND forced-rtdim vs the fixed hd64
kernel, cosine 1.000000 / worst|d|=0 across kvLen 1..257; pass-1 within
the sinks byte-band at kvLen=2000. Named boundary: the ICB record path
has its own resolver family with no fallback (pre-existing, refuses at
construction — follow-up, not attempted blind).

Co-Authored-By: Virgil <virgil@lethean.io>
…ne/rwkvserve)

The register switch generalises over model.SessionModel (composedTextModel
renamed sessionTextModel — the name stopped being true); tokenizer fallback
tokenizer.json → embedded World vocab (rwkv7) → honest error; plain-completion
dialect for the standalone recurrents. Third bug found live: chatTemplate's
empty-Open sentinel silently reverted undeclared-marker dialects to gemma
markers — fixed with an explicit set-flag + regression. Live: serve+curl
answers Paris; mamba2 70 tests green.

Co-Authored-By: Virgil <virgil@lethean.io>
Transcriber capability interface (go/inference.go, the VisionModel/
AudioModel stability-contract pattern) discovered by type-assertion;
whisper.Model.TranscribeAudio adapts Transcribe's Options/Result shape
to the primitive-string contract so the whisper package satisfies it
structurally, with no import in either direction.

openai.TranscriptionHandler serves OpenAI-compatible multipart upload
plus this engine's JSON+base64 data-URL extension (the image_url
precedent -- data: URLs only, no remote fetch), response_format
json/text, always mounted so a non-whisper (or model-less) serve gets
the clean 400 capability refusal rather than a 404.

Loader integration: whisper.IsWhisperCheckpoint cheaply probes
--model's config.json; RunServe's detectAndLoadWhisper runs before the
ordinary chat hot-swap/multi-model wiring and routes the WHOLE process
into ASR-only serving when it matches (fatal-at-boot on a load
failure, matching the outbound-policy/embed-model fail-closed
precedent) -- the v1 "one process, one purpose" shape: chat/embeddings
degrade to the existing model-less refusal, exactly as a plain --model
"" start already behaves.

Gates: compat-shape + capability-refusal tests in
serving/provider/openai/transcription_test.go and
serving/compat/admin_test.go; mux/serve wiring re-verified against the
existing suite (2620 tests, serving tree + whisper package, all
green). Live round trip (task build; bin/lem serve --model
<whisper-tiny>; curl both multipart and JSON data-URL) returns the
exact golden transcript byte-for-byte in ~21s (encoder-dominated, see
the KV-cache commit) via both surfaces; wrong-method/missing-file/
remote-URL-refused/chat-route-model-less all verified live too.

Co-Authored-By: Virgil <virgil@lethean.io>
/v1/audio/transcriptions (multipart + base64 data-URL, image precedent;
always mounted, 400 without a transcriber; remote URLs refused) via the
Transcriber stability-contract interface; serve routes a whisper --model
into ASR-only serving fail-closed. Decoder self-attn KV cache bit-exact
vs the recompute oracle (maxAbsDiff 0); decode loop 1.508s -> 0.385s.
Honest receipt: end-to-end ~20s because the encoder's O(1500^2) self-attn
dominates (~88%) — the named next perf target, not claimed fixed. Live:
exact golden transcript through both curl surfaces; chat on a whisper
serve degrades to the model-less refusal.

Co-Authored-By: Virgil <virgil@lethean.io>
…llback (#48)

The TQ live-KV v1 sent prompt prefill down the per-token replay: a ~65x
prefill regression versus the batched pass, disqualifying for the very
long-context case TQ exists for. This wires the batched/chunked dense
prefill to be TQ-aware.

Store side: the chunk's roped/normed K/V land into the code caches via
the existing lthn_tq_kv_store kernel dispatched at grid width
kvHeads*numRows (encTQKVStoreRows) — one dispatch per chunk, no new store
kernel. Read side: a NEW lthn_tq_kv_dequant_bf16 kernel reconstructs the
prior history codes (Piᵀ*gamma*centroid) into a reusable per-layer bf16
scratch and the ordinary chunk-attention SDPA (multiQ/GEMM/flash) scores
against it unchanged. The scratch is INCREMENTAL across chunks (a
high-water mark appends only each chunk's own rows — never re-dequantising
the history, the O(n²) trap) and is freed at the prefill->decode
transition, so the deep-context residency win is kept during generation.

Root-caused a hard bug the batched path exposed: lthn_tq_kv_store read
red[0] (gamma) then reused red for u WITHOUT a barrier. At head dim 512
(16 simd-groups) a group reaching the overwrite raced a lagging group
still reading gamma, handing it u[0] — benign at 1 threadgroup (the
per-token decode kept groups in step) but a hard corruption once the
batched prefill interleaves many threadgroups. Added the barrier; the
store→dequant round-trip drops from >100% error to the ~0.1 codec floor
at every instantiated head dim.

Receipts (real e2b-4bit, this box — machine load-caveated, a 99% peer
process ran during some runs):
- retrieval: batched RETRIEVES "7412" through the code caches in ~1.5s
  vs ~11.4s per-token (LTHN_TQ_BATCHED_PREFILL=0); the fact ~1047 tokens
  back surfaces.
- decode live gate unchanged: top-1 62/64, max |logit Δ| 6.16.
- prefill throughput (3482-tok prompt): batched 7303 tok/s vs per-token
  113 tok/s (~65x). Stable across reruns.
- parity: batched-vs-sequential next-token argmax AGREES, max |logit Δ|
  0.125 (codec band, not byte-tight — different accumulation order +
  bf16 reconstruction rounding; stated in the test).

LTHN_TQ_BATCHED_PREFILL=0 pins the pre-#48 per-token path (the A/B lever).
Sliding/local layers, non-TQ layers and the below-fold-gate small-chunk
case are byte-identical untouched (decline to the per-token replay).

Co-Authored-By: Virgil <virgil@lethean.io>
Store lands whole chunks in one dispatch; NEW lthn_tq_kv_dequant_bf16
reconstructs prior history into a per-layer scratch with an incremental
high-water mark (never re-dequantising), freed at prefill->decode so the
residency win survives generation. LTHN_TQ_BATCHED_PREFILL=0 is the A/B
lever. Load-bearing race FOUND+FIXED in lthn_tq_kv_store: gamma read and
red[] reuse had no barrier — benign per-token, corrupt under batched
interleave at hd512. Receipts: 3482-token prompt 7303 vs 113 tok/s;
retrieval prefill 11.40s -> 1.49s; parity argmax-agree (codec band
0.125); TQ suite 80 green; live gates unchanged (62/64).

Co-Authored-By: Virgil <virgil@lethean.io>

# Conflicts:
#	cli/lthn_kernels.metallib.gz
…ned the suite

sdpaVectorDispatchForHeadDim latched a width as missing on ANY fixed-
lookup failure and the rtdim PSO getters latched their errors — one
transient library-teardown window in a full-suite run rerouted every
later caller and cascaded 199 failures. Fixed lookup now runs every
call (PSO success caches make it cheap), the missing-map gates only
the one-time notice, and both rtdim getters retry until success.

Co-Authored-By: Virgil <virgil@lethean.io>
An absent fixed width with a live customLibrary now SERVES via the
runtime-dim fallback (pinned), and the kernel-not-found error leg needs
both libraries gone (custom nulled within the wrong-main scope). This
test's mid-suite library swap was the transient window that the old
error-latching resolvers turned into the 199-failure cascade.

Co-Authored-By: Virgil <virgil@lethean.io>
…ches registered in the reset, inline null/restore, dead err vars dropped

The nulled-custom error leg needs the rtdim PSO caches actually cleared
(they were unknown to resetNativePipelineCachesForCoverage) and the
restore must happen before the success half (t.Cleanup fires at test
end). The fallback contract is now pinned both ways: absent width +
live custom serves; both libraries gone errors.

Co-Authored-By: Virgil <virgil@lethean.io>
… >15-token divergence is the serve lane's chat framing + bf16-head seam (#36)

Adds the mamba2-pair parity test family for rwkv7 (TestRWKV7DeviceProjMatchesReference
at every real 0.1B-checkpoint GEMM shape; a real-checkpoint device-vs-host band over 32
sequential carried-state steps; a closed-loop 32-token greedy verdict) plus
RWKV7Session.HeadLogits, an exported f32 seam mirroring composed.HeadLogitsHost for
device-vs-host receipts from outside the package.

Verdict: outcome (c). rwkv7.ProjMatMul/ProjMatMulInto (the steel GEMM hook) produces
BYTE-IDENTICAL greedy output to the pure-host path over 32 closed-loop tokens on the
real RWKV7-Goose-World2.8-0.1B-HF checkpoint (band test: logit cosine 1.00000000,
zero own-argmax disagreements) — the device hook is fully exonerated. The reported
divergence traces to two serve-lane factors, neither the device hook: (1) bin/lem
generate's stateless path always calls TextModel.Chat, which frames the prompt through
rwkv7's declared plain-completion template ("\n"+content+"\n\n") — a different token
stream from position 0, proven by direct tokenisation comparison; (2) the
SessionModel/TokenModel serve contract's bf16-rounded LM head (vs RWKV7Session's own
f32 argmax) independently diverges from the pure-host reference at generated position
22 on an identical raw prompt — closely matching the reported "~15 tokens" onset.

New test files live in engine/metal rather than model/arch/rwkv7: that package's test
binary is shared across ALL its _test.go files, and importing engine/metal from there
would run native's init() for the whole suite, silently switching every host-only rwkv7
test onto the Metal GPU.

Gates: go build ./... and go vet ./engine/metal/ ./model/arch/rwkv7/ clean; all new
tests green (MLX_METALLIB_PATH set, scoped -run); the full rwkv7 package suite green
(122 tests); TestRWKV7RealCheckpointOracle and TestRWKV7RealCheckpointGenerationSmoke
green (RWKV7_SMOKE_DIR); the full engine/metal suite shows zero rwkv7/mamba2 failures
(pre-existing SDPA-pipeline failures elsewhere in that run trace to a stale borrowed
metallib build artefact, unrelated to this change — verified by diverged kernel-source
git history, not a regression).

Co-Authored-By: Virgil <virgil@lethean.io>
Steel-GEMM hook byte-identical to pure-host over 32 closed-loop greedy
steps on the real Goose 0.1B (logit cosine 1.00000000, zero argmax
disagreements; 18-shape proj parity worst |d| ~3e-5). The reported
divergence decomposed: lem generate always Chat-frames (different
stream from position 0, by design), and the serve contract's bf16
LM-head rounding flips a near-tie argmax at generated position 22 vs
the session's f32 argmax — documented, not a defect. HeadLogits f32
seam exported for receipts.

Co-Authored-By: Virgil <virgil@lethean.io>
…tion (#48)

Single-pass TQ decode (lthn_sdpa_vector_tq, kernels/lthn_tq_kv.metal) now
folds Πq and Πᵀy into itself — one threadgroup per head already has the
whole row in threadgroup memory, so each fold runs exactly once, same
total FLOPs, just no separate lthn_tq_rot_rows_bf16 dispatch either side.
q reads RAW, out receives the FINAL (unrotated) value directly — the same
shape as the plain/q8 SDPA ops. Buffer 15 (free on the single-pass ABI)
carries the resident Π the fold reads.

The 2-pass pair (lthn_sdpa_vector_2pass_1_tq) stays UNFUSED and unchanged:
its pass-1 grid runs `blocks` threadgroups per kv-head (up to 512), so
folding an O(d²) rotation there would redo that work once per block
instead of once per head — the house fusion rule the opposite way. Its
ABI was also already at 16/16 binds. Pass-2 (MLX's sdpa_vector_2pass_2,
which owns the merged output vector) is shared kernel code outside this
lane's ownership. The recorder (decode_forward_arch_icb.go) now branches
on sdpa2PassICBBlocks: single-pass emits ONE op per TQ-reading layer per
token instead of three (rotate + SDPA + unrotate -> SDPA alone), and the
qRotTQ/attnRotTQ staging buffers are no longer allocated for that lane.

tq_unpack_idx (both SDPA kernels + the batched-prefill dequant kernel)
widens from a per-bit loop to a masked 16-bit word read — bit-identical
output, fewer device reads. lthn_turboquant.metal's S2 dequant kernel gets
the same widening for consistency.

Gates (scoped, this box, single-attempt local wall-clock — not a
dedicated bench rig, no other lane running):
  - MLX_METALLIB_PATH=... go test -run 'TQ|TurboQuant' ./engine/metal/:
    62 passed, 0 failed, 3 skipped (LEM_REAL_E2B-gated). Single-pass
    parity band tightened to <=0.0020 (was <=0.0041 typical/0.0369 worst)
    — the fusion also removes 2 intermediate bf16 round-trips. 2-pass band
    unchanged (<=0.0008), as expected for an unfused kernel.
  - LEM_REAL_E2B=1 go test -run TestRealE2BTurboQuantLive ./engine/metal/:
    both PASS — top-1 agreement 62/64 (max |logit delta| 6.16, floor 12),
    retrieval fact recovered at ~1047 tokens back. maxLen=2048 exercises
    the (unchanged) 2-pass lane.
  - bin/lem generate -kv-cache turboquant:4, real e2b-4bit, median of 3
    (before = base commit 8600143, kernels+lem rebuilt from it; after =
    this commit; native = no -kv-cache, same build):
      single-pass (-context 800, ~730 tok deep): before 116.0 tok/s ->
      after 134.9 tok/s (+16.3%); native 172.6 tok/s reference.
      2-pass (-context 2200, ~1980 tok deep): before 117.0 tok/s -> after
      115.9 tok/s (flat, within run-to-run noise); native 171.6 tok/s.
  - go vet ./engine/metal/ clean; gofmt clean on all 6 touched files.

Co-Authored-By: Virgil <virgil@lethean.io>
… pre-checkpoint

Establishes exactly what #37 asked: DFlash is a REAL, distinct external
drafter family (z-lab/RedHatAI publish real checkpoints on HF, one with
226k downloads) — not a stale backlog entry, not an internal codename. But
engine/metal/assistant_dflash*.go was built from the arXiv description
before any real checkpoint existed to check it against (its own commit
message says so), and checked now against three real checkpoints across
the two conventions the wild actually uses, its architecture does not
match either — itemised at both the config level (wrong JSON keys/nesting,
verifier.name vs the real .name_or_path) and the maths level (gemma4
sandwich-norm+GELU reused verbatim where every real checkpoint is a plain
2-norm qwen3 layer with SiLU; no intra-block self-attention where that IS
the actual diffusion mechanism, not a documented-later refinement; numAux
conflates fused-layer-count with cross-attention context length; invented
dflash.lm_head/d2t tensors no real z-lab checkpoint carries).

docs/design-dflash.md (the memo these files still cite) was retired
2026-07-14 once the contract slice + engine forward "landed" — verified
against its own assumed shape, never against reality. DFlashEngineProbe
has stayed honestly false throughout; this survey explains precisely why
it should stay false until the punch list in §6 lands, rather than being
flipped against a still-wrong forward.

Co-Authored-By: Virgil <virgil@lethean.io>
ParseConfig previously matched only speculators_model_type=="dflash" — the
RedHatAI/speculators-library shape — and even there read the wrong
verifier key (.name; every real checkpoint found uses .name_or_path).
z-lab's own convention (every checkpoint the paper's own lab publishes,
z-lab/Qwen3-4B/8B/27B/35B-A3B-DFlash, gemma-4-26B-A4B-it-DFlash, ...) sets
no speculators_model_type at all: its marker is
architectures:["DFlashDraftModel"] beside a dflash_config object nesting
target_layer_ids/mask_token_id. No checkpoint this survey found (z-lab or
RedHatAI) was recognised by the old single-convention check.

Both conventions set architectures:["DFlashDraftModel"], so that alone is
now sufficient to recognise either; field reads try each convention's own
path (aux_hidden_state_layer_ids vs dflash_config.target_layer_ids,
top-level vs nested mask_token_id, .name_or_path vs .name) with sane
fallback. Adds Config.MaskTokenID — real generation bookkeeping (the
block's not-yet-drafted positions' starting embedding) every real
checkpoint declares and the old struct had no field for at all.

New tests use real checkpoint config.json byte content verbatim (z-lab/
Qwen3-4B-DFlash-b16, RedHatAI/NVIDIA-Nemotron-3-Super-120B-A12B-
speculator.dflash), cited by source repo — never guessed. All 17 existing
tests unaffected (backward-compatible struct addition, no positional
literals at any call site).

Gates: go build ./... && go vet ./... clean (whole module); gofmt clean;
go test ./decode/dflash/... — 30 passed (was 17).

Co-Authored-By: Virgil <virgil@lethean.io>
…le-gated

ZLabForward is a from-scratch, engine-free (no cgo, no GPU) pure-Go f32
implementation of DFlashDraftModel.forward() — the REAL architecture every
published z-lab checkpoint uses, correctly shaped per the #37 survey
(docs/design-dflash-survey.md): plain 2-norm qwen3 decoder layers, k_norm
on the CONCATENATED context+noise K (not the injected-context-only rows
engine/metal assumes), genuine intra-block self-attention joined into the
SAME softmax as the cross-attention context (the actual diffusion
mechanism, not a deferred refinement), SiLU-gated MLP, fc+hidden_norm
context fusion. It borrows no target lm_head/embed_tokens (z-lab's
checkpoints carry neither), matching the real tensor set exactly —
fc.weight/hidden_norm.weight/layers.N.*/norm.weight, no "model."/"dflash."
prefix, no invented reduced-vocab head.

Oracle-gated two ways: a synthetic varied-weight Good/Bad/Ugly suite
(shape, determinism, non-vacuousness, honest refusals — runs always, no
download) and TestZLabForward_RealCheckpoint, env-gated on
LTHN_DFLASH_ZLAB_CKPT (the model/quant/awq LEM_AWQ_REFERENCE_DIR pattern —
skips cleanly without it) against testdata/zlab_qwen3_4b_oracle.json: exact
inputs/expected outputs at 3 depths (after layer 0, after layer 2, final
norm) from an independent numpy re-implementation run over
z-lab/Qwen3-4B-DFlash-b16's REAL downloaded weights — itself cross-checked
against that checkpoint's own modeling_dflash.py executed through
transformers (trust_remote_code), not just against my own reading of it.

Receipt, run against the real checkpoint (LTHN_DFLASH_ZLAB_CKPT set):
  after_layer_0: max abs diff 0.079  across 10240 values (hidden std ~120)
  after_layer_2: max abs diff 0.100  across 10240 values (hidden std ~135)
  final_norm:    max abs diff 0.0023 across 10240 values (hidden std ~2.6)

This does not change what serve or engine/metal do (DFlashEngineProbe
stays false — see survey §6 for why and the precise punch list); it proves
the architecture reading is correct against real weights before any
engine-side rewrite, the model/needle package's own "de-risk before an
accelerated port" posture.

Gates: go build ./... && go vet ./... clean (whole module); gofmt clean;
go test ./decode/dflash/... — 30 passed, 1 clean skip without the env var,
30 passed (incl. the real-checkpoint gate) with it set.

Co-Authored-By: Virgil <virgil@lethean.io>
…lane/tqperf)

Πq/Πᵀy fused into lthn_sdpa_vector_tq (3→1 dispatches per TQ layer per
token); masked-word unpack widening in both TQ kernels. Parity band
TIGHTENED to ≤0.0020 (two bf16 round-trips eliminated); live gates
unchanged (62/64, retrieval). Receipt (E2B-4bit, medians of 3): single-
pass 116.0→134.9 tok/s (+16.3%), native 172.6; 2-pass deliberately
unfused (per-block rotation replication — the fusion rule inverted)
and flat at 115.9, confirming the boundary cost nothing.

Co-Authored-By: Virgil <virgil@lethean.io>
Survey verdict: DFlash IS a real external drafter family (z-lab, arXiv
2602.06036 — Qwen3.6-35B drafter at 226k downloads; z-lab even ships
gemma-4-26B-A4B-it-DFlash). The existing engine forward was built from
the paper BEFORE any checkpoint existed and matches NEITHER real
convention (gemma4 sandwich-norm+GELU vs the real 2-norm qwen3+SiLU;
missing the intra-block attention that IS the mechanism; invented
tensors). DFlashEngineProbe correctly stayed false throughout — the
honest decline held. Landed: ParseConfig for BOTH real conventions
(+ the .name vs .name_or_path bug), ZLabForward pure-Go f32 oracle-
gated against real downloaded weights (final_norm max|d| 0.0023 @ std
2.6), 30 tests, the survey doc with the engine-rewrite punch list.

Co-Authored-By: Virgil <virgil@lethean.io>
…reference dumps

The E2B capture-vs-oracle divergence (#44: layers 8-14, worst 11 at 0.83)
needed a sublayer-resolution instrument to name its first diverging station:

- decode_forward_arch.go grows a post-MLP capture point (capturedMLPResHiddens,
  captureLayerHiddens-gated like its attn sibling) so the serial walk exposes
  attn_res -> mlp_res -> layer_out per layer.
- testdata/e2b_mirror_oracle.py additionally dumps mlp_res.f32 (residual after
  the MLP, before the PLE gate) — the matching oracle station.
- testdata/e2b_mlx_reference.py (new) captures mlx-lm's OWN bf16 per-layer
  hiddens for the same parity ids into the same dump dir — the bf16 reference
  implementation the discriminator gates against.
- train_e2b_sublayer_probe_test.go (new, env-gated) drills a layer into
  stations against the oracle dumps: per-layer-input rows, PLE weight
  fingerprints (transpose-invariant sums + layer scalar), attn/mlp/out station
  cosines, optional f32 station dumps (E2B_SUBLAYER_DUMP_DIR) for offline
  delta analysis.

Receipts from the instrument (fb0b16 snapshot, 8 parity ids): pli rows >=
0.999991 all 35 layers; PLE gate/proj/norm sums + scalars bit-exact vs the
checkpoint; first clean-input break = layer 8 SECOND half (attn 0.999788,
mlp 0.999171, out 0.966658), token-resolved to parity token 6.

Co-Authored-By: Virgil <virgil@lethean.io>
…e defect; gates go HARD at the correct bar

MECHANISM (named): chaotic amplification of correctly-rounded bf16
residual-stream storage through E2B layer 8's gelu cliffs — not a wrong
per-layer table, boundary, rope region, or kernel. The proof chain, each step
from the #49 sublayer instrument on the real E2B bf16 checkpoint:

- Every consumed per-layer parameter is bit-exact (PLE gate/projection/norm
  sums, layer scalars) and the engine's per-layer-input rows match the oracle
  >= 0.999991 on all 35 layers.
- Every sublayer is arithmetically FAITHFUL: recomputing layer 8's MLP half
  and PLE half in f64 from the ENGINE'S OWN captured inputs reproduces the
  engine's outputs to 1-cos <= 3e-6 — and reproduces the ORACLE when fed the
  oracle's inputs. There is no defective station.
- The input difference driving it is storage dust: gemma giant channels
  (|h|~100, 1 bf16 ULP = 0.5) drift +-2 ULP over layers 0-7 (correctly-rounded
  random walk; per-station cosines >= 0.99987). Layer 8, parity token 6: the
  MLP's 38 near-cliff gelu gates amplify 1-cos 2e-4 -> 6e-3 (x30); the PLE
  gate (branch rms >= residual rms, pli values to 18) amplifies 6e-3 -> 0.30
  (x50). Tokens 0-5,7 stay <= 1e-3 through layer 12; token 7 catches 3e-2
  from token 6's polluted KV. The pli-dominated giant branches at layers
  13/14 (rms 6.5/12) are pli-driven and wash the error back down — the
  observed "recovery".
- DECISIVE: mlx-lm's own bf16 forward (testdata/e2b_mlx_reference.py) diverges
  from the same f64 oracle with the SAME signature — first bad 8, worst 11 at
  0.8316 (engine 0.8342), same recovery, same token-6 concentration — while
  engine-vs-mlx stays >= 0.9985 at EVERY layer. bf16 forwards form a tight
  equivalence class (station rounding lands on the same bf16 grid); the f64
  trajectory exits that class at the chaos layers. A 0.9999-vs-f64 bar is
  unreachable for ANY bf16-stationed forward, the ecosystem reference
  included.

GATES (flipped to HARD at the correct bar):
- TestForwardCaptureHiddensE2BVsOracle now t.Fatalf's per layer on:
  engine-vs-mlx < 0.9975 (observed floor 0.99851); engine trailing the mlx
  ground-truth envelope by > 0.0075 (observed worst gap 0.0045 at layer 8);
  any pre-chaos layer (mlx >= 0.9999 vs oracle) below 0.9998 (observed
  >= 0.99993). Green on BOTH routes (ICB worst-oracle 0.8342, serial 0.8385).
- TestLoRATrainerE2BSharedKVSFT_Good's B=0 anchor is HARD again at the
  envelope tripwire (worst-layer >= 0.80; observed 0.8304); live SFT smoke
  green: loss 18.5051 -> 9.0720 over 5 steps, adapter round-trip 100 tensors,
  consumers carry no k/v.

Quant path verdict: same per-layer tables through the same stepTokenEncode
walk (ple[li], lb[li], pliOff) — proven correctly indexed by the bf16
investigation; no defect class exists to port a fix for. Serve path untouched:
DecodeForwardArch|HostReference|Parity = 95 passed; no serving code changed.

Co-Authored-By: Virgil <virgil@lethean.io>
…proven + hard-gated (lane/fwd49)

f64 recomputation from the engine's own captured inputs reproduces the
engine to 1-cos <= 3e-6 (every station faithful); mlx-lm's own bf16
forward diverges from the same f64 oracle with the IDENTICAL signature
(first bad 8, worst 0.8316 @ 11 vs engine 0.8342) while engine-vs-mlx
>= 0.9985 all layers — bf16 forwards are an equivalence class and the
0.9999-vs-f64 bar was unreachable for ANY of them. Mechanism: +-2 ULP
giant-channel storage dust -> layer-8 gelu cliff (~30x) -> PLE gate
(~50x) on one token, washed back by the giant PLE branches at 13/14.
Discriminator now Fatalf at the PROVEN bar (vs-mlx >= 0.9975, envelope,
pre-chaos >= 0.9998, both routes); E2B SFT anchor HARD again (worst
0.8304 >= 0.80; loss 18.5051 -> 9.0720). Quant path: same tables,
correctly indexed, no defect class to port.

Co-Authored-By: Virgil <virgil@lethean.io>
…-f32

DOTS-OCR moves from "recognised, refuses" to working library-level OCR, per
the whisper template: real checkpoint (rednote-hilab/dots.ocr, verified via
snapshot_download against the recogniser's own naming), real tensor map
(never guessed — every name/shape/bias-presence confirmed against the actual
643-tensor safetensors index), host-f32 vision tower + decoder forward, and a
public OCR(imageBytes, prompt) entry point.

Architecture (confirmed from the shipped custom_code, not assumed):
- Text decoder is an UNMODIFIED Qwen2ForCausalLM (GQA, 1D RoPE theta=1e6,
  SwiGLU, untied lm_head — modeling_dots_ocr.py subclasses Qwen2ForCausalLM
  directly and only overrides embedding preparation).
- Vision tower is NaViT-style (modeling_dots_vision.py): a Conv2d patch embed
  that folds exactly into a dense [1536,588] projection (verified 0.0 max-abs
  -diff against the real nn.Conv2d module), 2D rotary (h/w split halves),
  full (non-causal, single-image) attention, SwiGLU, PatchMerger.
- Image preprocessing replicates transformers' Qwen2VLImageProcessorPil
  (smart_resize + patchify): dimension maths and normalise/patchify are
  bit-exact vs the real processor; pixel resampling for non-aligned images
  is a named approximation (bilinear vs the reference's PIL bicubic) —
  invisible to the committed fixture, which is pre-aligned to the 28px grid.
- Prompt construction was cross-checked empirically against the real
  chat_template + processor, not derived from reading the Jinja alone — a
  first attempt got the <|user|>/<|endofuser|> wrapper wrong for list-content
  messages; the golden catches it.

Reference-run method: torch 2.11 + transformers 5.5.4 (trust_remote_code),
float32 CPU, in the venv named in the task brief. Found and worked around a
real from_pretrained loading defect in this environment: DotsVisionTransformer's
VisionRotaryEmbedding.inv_freq (a non-persistent, __init__-computed buffer)
comes out all-zero after AutoModelForCausalLM.from_pretrained, while a freshly
constructed instance computes it correctly — confirmed by direct comparison.
Unpatched, vision attention silently loses all positional information; this
is very likely why an early capture produced degenerate repeated-bbox output.
Fixed in the capture script by rebuilding the submodule and copying its
correct buffer over the loaded one before capturing any vision golden.

Goldens (testdata/, captured against the real checkpoint): smart_resize
dimension table, image preprocessing (sampled patch rows vs the real
Qwen2VLImageProcessorPil on the committed fixture.png), a real-weights vision
block/tower pass on a synthetic grid, a real-weights decoder layer/stack pass
on a short prompt, prompt-construction cross-check, and one full E2E: the
committed fixture.png ("Lethean OCR 2026", PIL-generated, testdata/gen_fixture.py)
through the real checkpoint's own forward() (model.generate() itself throws
inside this checkpoint's prepare_inputs_for_generation under this transformers
version — a real custom_code incompatibility, not this port's bug; worked
around with a hand-rolled greedy loop calling the same real forward()).

Gates: go build/vet clean on the touched packages AND the whole go/ and
examples/ modules; gofmt clean; 49 hermetic tests + 3 Examples green
(smart_resize, patchify, prompt construction, KV-cache batching parity,
scatter, config/weights error paths — all package-private, white-box). 7
env-gated live tests (DOTS_OCR_DIR) against the real checkpoint ALL PASS,
including the E2E OCR() call reproducing the reference's exact greedy
generation verbatim — timings load-caveated (this box, sibling lanes
resident): Load ~2s, vision-block checks ~2-7s each, decoder full-stack
~10s, full E2E OCR ~548s (245-token prefill + ~40 generated tokens, pure-Go
scalar float64 accumulation, no BLAS — device fusion is explicitly out of
scope for this lane).

Boundaries named plainly: bilinear (not bicubic) resampling for images
needing an actual resize; single static image per call (no video/multi-
frame batching — matches the OCR() signature); temporal_patch_size and
num_channels other than the checkpoint's own (1, 3) refuse rather than
guess; register.go's Composed/Arch refusal is untouched — this ships as a
separate own-loader entry point, exactly like whisper's, and does not touch
go/engine/**, serving/, model/composed/, or cli/.

Co-Authored-By: Virgil <virgil@lethean.io>
The 26B-A4B pair decoded 50 tok/s against 138 plain AT 64-71% acceptance —
the verify forward was flat ~43-55ms for K=3 AND K=5 (a plain step: 7.2ms).
LTHN_GPU_TRACE=host indicted the seam, not the GPU: every verify round paid
syncKV 5-12ms + reloadKV 25-42ms, BOTH growing with position — a full-prefix
paged->linear->paged round-trip (with q8 recode both ways, the sync-side
dequant single-threaded) to move K=5 rows. The winning E2B pair pays 0.0ms.

Fix: copy only the rows that changed. syncLinearKVFromDevicePaged copies
[watermark, basePos) direct page->lb (no more full linearSnapshot + clear per
round); reloadDevicePagedKVFromLinear pushes only the batch's landed rows
[pool high-water, basePos+K) back via slot(). Ring caches get an absolute
mirror watermark (linearSyncedAbs) — slot() overwrites and truncate() lower
it; loadLinearSnapshot zeroes it (state-restore provenance unknown). The full
paths remain as in-code fallback for undeclared geometry and behind
LTHN_KV_SYNC_DELTA=0 (repro anchor). q8 pages now code each landed row ONCE
(the serial lane's coding) instead of re-quantising the whole prefix each
round.

Receipts (26B-A4B qat-4bit + official assistant, temp 0, box under 3-lane
load — ratios load-insensitive, absolute ms caveated):
  pair decode  50.1 -> 106.4 tok/s (128 tok, 67% acceptance unchanged)
  syncKV   5-12ms/round -> 0.0ms
  reloadKV 25-42ms/round (position-growing) -> 2.3-4.4ms flat (K rows)
  verify fwd 43-55ms -> 14-21ms
Scoped gates: paged-KV suite 27 green (9 new one-per-symbol tests);
MTP|Mtp|Speculative|Reforge 152 green; Verify|MoE|Moe|Assistant 344 green,
1 pre-existing fail (TestMoEBlockBF16AllocationBudget allocs=5>4) which
fails identically at clean HEAD 5353d20 in the untouched main tree.

Co-Authored-By: Virgil <virgil@lethean.io>
Snider and others added 18 commits July 21, 2026 16:22
Stage the K verify rows' attention as concurrent waves on the round's
single command buffer instead of K serial encAttnHalfKVPagedInputAt
calls: W1 RMS-norms, W2 q/k/v projections, W3 ropes + value-norms,
then landing + SDPA, W7 output projections, W8 residuals, with
memoryBarrierObject only at true stage edges. Global KV layers land
all K rows' pages then scan barrier-free (causal lens baked per row);
ring/sliding layers keep the per-row land->scan chain so later
landings still evict inside earlier rows' windows in eviction order.

The causality trap en route: buildSDPAPagedDecodePlan borrows the
cache's shared state() scratch slices, so deferring K emissions past
K state() calls aliased every plan onto the last row's lens. Per-row
deep copies of the seven borrowed slices fix it; the RowsDriver
byte-parity gate caught the miss.

26B-A4B pair receipt: 93.2 -> 104.3 tok/s (400 tok / 3.826s), 60%
acceptance (347/575) over 115 verify forwards, output byte-identical
to the pre-campaign pair. Cumulative for the campaign: 15.6 -> 104.3
(6.7x), router per-row reduction untouched throughout. Full metal
suite 2796 green.

Co-Authored-By: Virgil <virgil@lethean.io>
…hed canonical head, ring waves below the wrap point

Three submission-shape levers on the #53 chained round, each
output-invariant by construction and receipted on the canonical 26B-A4B
pair (greedy, 400 tok, counting prompt), text byte-identical at every
step:

- Chunked commits (rowsChainCommitStride): the round previously encoded
  all layers, THEN ran — the GPU sat idle behind ~6ms of CPU encode.
  Committing each layer's buffer as soon as it is encoded (stride 1 won
  the sweep: 135.9/135.3/133.7/132.5/130.0 tok/s at 1/2/4/6/8) lets
  execution chase the encoder. Cross-buffer ordering is the device
  timeline's: every buffer is default hazard-tracked and consecutive
  chunks always depend through the rotating slabs. 104.3 -> 116.0.

- Batched canonical head (greedyRowsCanonicalInPool): the verify rows
  all resolve to greedyInPool's upload + encodeGreedyAt chain, K
  commit+wait round-trips deep. One command buffer, K unchanged per-row
  chains on their own scratches, one wait. This batches the CANONICAL
  argmax tier by submission shape only — not the qmm_t rows-head tier,
  which stays behind LTHN_MTP_ROWS_HEAD (#55). 116.0 -> 117.7.

- Ring wave below the wrap point: slot() is pos%maxSize, the identity
  while the round's landings stay under maxSize — no eviction is
  possible, so sliding layers take the global land-all-then-scan wave
  shape (virgin-slot argument) instead of K serial land->scan chains.
  Rounds that CAN wrap keep the serial chain (eviction order is the
  byte contract). 25 of the 26B's 30 layers are sliding. 117.7 -> 130.0.

New parity pins: TestMTPRowsDriverVerifyMatchesRowMajorSliding_Good
runs the driver-vs-row-major byte compare on an all-sliding fixture at
BOTH regimes (window 16 = wave, window 4 = serial wrap). Full metal
suite 2799 green; interleaved 3x receipt below with the block-default
commit.

Co-Authored-By: Virgil <virgil@lethean.io>
A quant-MoE target's verify round carries a higher fixed cost (router +
expert gathers + the K-row head amortise per round), so a longer draft
block pays there and only there. The 26B-A4B block sweep read
127.4 / 135.6 / 135.9 / 137.4 / 136.7 / 129.6 tok/s at blocks 3..8
(knee at 6); the SAME sweep on E2B (dense-PLE) regressed 96.6 -> 88.5
at 6. LoadSpeculativePair now resolves a deferred block (<=0) to 6 when
the attached target arch HasMoE(), 5 otherwise; an explicit
-draft-block always wins.

The generate CLI previously pre-substituted the shared constant 5
before the loader ever saw the flag — it now passes 0 through, same
shape as serve's resolver, so the loader owns the default in both
lanes. Boot notices print "engine-default block" instead of pre-claiming
a number the notice cannot know.

THE GAUGE (#53, "mtp can't be slower than without"): interleaved 3x on
the canonical 26B receipt, this build, defaults —
  plain 132.6 / 133.3 / 132.5  vs  pair 137.7 / 137.1 / 137.4
Pair beats plain by ~3.6% at defaults, output byte-identical, 72%
acceptance over 83 verify forwards. Campaign cumulative: 15.6 -> 137.4
(8.8x). E2B default lane unchanged (115 forwards = block 5).

Co-Authored-By: Virgil <virgil@lethean.io>
…s + §7d

The missing comparator from §7c's honest conclusion now exists: the
checkpoint's OWN spec_generate (torch/MPS, method source re-exec'd with
only the return widened) reads 17.10% accept / 3.565 tokens/round on the
survey prompts vs our 7.8% / 2.087 — the pairing is healthy, the gap was
real, and the hunt is now CONCLUDED, not open: fused context 0.3%,
layer-0 attention 0.6%, all five layers 0.7-2.5% at every position on
torch-exact inputs, target embedding row byte-exact — no structural
fault in the engine forward. The gap's mechanism is numeric-regime tie
correlation: the drafter's argmaxes are knife-edge (the same forward
flips fib's match depth 9 -> 1 on a ±0.25% input change) and the
checkpoint's ties were shaped by torch-bf16 rounding. Full evidence and
the one honest fix lane (a torch-bf16-equivalent forward mode) in
docs/design-dflash-forward.md §7d.

New env-gated instruments (skip without the real checkpoints):
assistant_dflash_zlab_round1_test.go — reference-frame round-1 proposal
log; assistant_dflash_zlab_xfeed_test.go — torch-exact context feed with
per-stage isolation (fused ctx, layer bisect, l0 attention, embedding
byte-parity). Both carry the embedID shared-scratch pin the first bisect
run paid for learning about.

DFlashEngineProbe stays false; whether the bf16-fidelity lane is worth
building for a non-gemma4 side drafter is a prioritisation call.

Co-Authored-By: Virgil <virgil@lethean.io>
…istic lane per stream

The batched small-K fold (qmm token-identity tier, the E2B 206-vs-131
lane) becomes the DEFAULT verify tier for every lane, greedy included
(Snider 2026-07-21). #55 fenced it from greedy because composed with the
#299 wall-clock re-engagement machinery the lane switching made timing
observable as flipped near-tie tokens (the q8race bistability). The
rearm keeps determinism the other way round: when the greedy stream
folds, GenerateFromSessionEach pins the wall-clock machinery OFF
(wallReengage) — drafting stays engaged, the only bail is the
count-based low-accept patience finishing the request plain permanently,
and the emitted stream is a pure function of the input again.
LTHN_MTP_VERIFY_FOLD=0 restores the byte-exact per-row lane everywhere
(the parity-forensics anchor); LTHN_MTP_REENGAGE=0 keeps its pre-#299
meaning on that lane. Quant-MoE targets are untouched (their dense fold
declines structurally; the rows driver continues to serve them).

Receipts (canonical greedy 400-tok counting prompt, this box):
- E2B qat + bf16 assistant: pair 96.6 -> 218.4 tok/s (plain 219.8 — a
  tie at 58% acceptance; block sweep 4/6/8: 216.1/219.1/184.7).
- E4B qat + qat assistant: pair 149.8 (plain 149.0); + bf16 assistant
  151.6.
- 26B-A4B: unaffected (rows-driver lane), pair 137.4 vs plain 132.6
  stands.

Test contract updates: TestMtpVerifyFoldArmed_* pin the rearmed routing;
the rows-driver parity pins and the two wall-clock re-engage scenario
tests pin the LTHN_MTP_VERIFY_FOLD=0 forensics lane their subjects now
live on. Full metal suite 2799 green with the rearm.

Co-Authored-By: Virgil <virgil@lethean.io>
…lean E4B

The rearmed fold exposed a pre-existing corruption (reproduces pre-rearm
under LTHN_MTP_VERIFY_FOLD=1): the uniform-4-bit lean E4B conversion
(mlx-community/gemma-4-e4b-it-4bit) produces all-NaN verify rows on the
recorded whole-stack verify ICB, surfacing as an invalid direct-argmax
token. Banked bisect (task #71): target-side not drafter-side
(cross-pair receipts); verifyStackICBDisabledForTest clears it while the
verify-tail lever does not; qmm_t is byte-clean at every e4b dim at
bits=4 in isolation; a bare non-ICB session serves the same verify
clean; plan routes are identical at bits 4 and 8. Workaround:
LTHN_VERIFY_STACK_ICB=0 — the plain-4bit E4B pair then runs clean at
173.4 tok/s, BEATING the qat pair's 151.6. Stack-replay value on
healthy checkpoints: qat E4B +3%, E2B nil — default stays on pending
the root cause.

Instruments: TestBatchedDenseFoldE4BPlain4BitNaN_Ugly (env-gated
live-stage bisect over the real pair lane, self-reporting which lever
clears the failure), e4b dim cases in TestQMMTAt31BDims, and NaN/stats
forensics on greedyRowsCanonicalInPool's invalid-argmax error path
(mirroring argmaxInvalidDiag one tier up).

Co-Authored-By: Virgil <virgil@lethean.io>
TestVerifyStackICBReplay_QMMTParity_Good: the recorder-recorded qmm_t
replayed via executeInto is byte-clean against the per-row qmv truth at
every live E-series MLP dim at bits 4 AND 8 (synthetic weights, no
model, runs in-suite) — proving the single-command ICB replay path and
narrowing #71's all-NaN corruption to the multi-command stack
composition. The record-arm trace line (LTHN_VERIFY_STACK_DEBUG) logs
K + basePos at recorder arming, which is what falsified the
rewind/reset and carry/width theories: the failing replay is a plain
forward-sequence first replay, any K, E4B interiors only (lean E2B
replays clean eight deep). Full bisect state in task #71.

Co-Authored-By: Virgil <virgil@lethean.io>
…ne and per-pass mutation exonerated

The E4B first-replay NaN hunt, session 3. Everything mutable per pass is now
falsified with live receipts: identity replay (same PLE slab via the grow-only
LTHN_VERIFY_STACK_PLE_PAD probe, no rebind rewrites via
LTHN_VERIFY_STACK_NO_REBIND, same basePos) still NaNs; the whole q8 lane is
out (LTHN_KV_Q8_ICB=0 bf16 recording still NaNs — the q8 scale corruption the
census shows at exactly the landing rows is a symptom: the store quantises an
already-poisoned stage); no single op class is the poison (honest
LTHN_VERIFY_STACK_SKIP_OP ladder — a skipped op's markRebindLast used to fail
the whole recording vacuously, lastSkipped now guards the marks); scale
metrics are out (skipped streams at 612 cmds / 40 rebinds / 0 dyn — all below
E2B's clean 678/89/33 — still NaN).

Instruments (all env-gated, default-off):
- LTHN_VERIFY_STACK_DEBUG: per-op-class histogram + layer-1 op sequence +
  per-layer command spans in the record-finish trace (layer-1 streams are
  op-identical E4B vs E2B; only dims differ).
- LTHN_VERIFY_STACK_ROWHASH=1: pass-end census — fold slabs, readRows, q8
  K-scale planes (names the corruption channel and the landing offsets).
- LTHN_VERIFY_STACK_REPLAY_LAYERS=N / _REPLAY_CMDS=M: prefix replay bisect
  (recorded interior through layer N / command M, live continuation). N=1
  NaNs on E4B and is clean on E2B.
- LTHN_VERIFY_STACK_SKIP_OP=<class>: omit one op class from the recording.
- LTHN_VERIFY_STACK_NO_REBIND / _PLE_PAD: identity-replay probes.

Green micros pinning what is NOT broken: the 7-op MLP chain (rms, gate,
up-with-overlapNext, gelu, down, rms, add) at both models' dims, and the
kv-q8 store byte-parity at kvDim 512/1024/256 landing at basePos 26.

Full state + next moves in task #71.

Co-Authored-By: Virgil <virgil@lethean.io>
…ags; poison map banked

Bottom-up map from the clean adds-only base: proj and rms@2560 are named
poison classes (each NaNs the base alone; all seven other classes are clean
alone); skip=proj,rms on the full stream still fails, so an interaction
poison remains. The decisive repro: the adds+rms2560 stream cut to TWO
interior layers (12 fully-barriered rms/add commands) NaNs on E4B and is
clean at one layer — and E2B replays the identical stream clean at five.
Layer 2 is the first in-place ping-pong layer. Full state in task #71.

Co-Authored-By: Virgil <virgil@lethean.io>
…dd micro; shard offsets >2^32 sighted

The captureBind dump on the minimal poisoned stream exposed the real
seven-command layer topology (the PLE epilogue's fused rms_residual writes
the rows a second time in place) and — the lead — norm weights binding the
~5GB mmap shard at offsets beyond 2^32 on E4B (4.94GB, 5.11GB), while E2B's
whole shard sits under 4.3GB. An ICB-side 32-bit buffer-offset limit would
explain the model split and the proj/rms poison classes exactly; the
committed two-layer micro (green at small offsets) gains >2^32-offset cases
next to give the verdict. Own-encoder replay falsified. Full state in #71.

Co-Authored-By: Virgil <virgil@lethean.io>
…ts >= 2^32; recorder declines such binds

The E4B first-replay NaN, hunted across three sessions, lands on a Metal
platform limit: an indirect compute command's setKernelBuffer offset is not
faithfully encoded at or above 2^32 bytes. The live encoder path is exact at
any offset; the replayed ICB bind reads the wrong bytes. E4B's ~5GB lean
shard binds its interior norm and projection weights at 4.3-5.1GB offsets —
every whole-stack verify replay corrupted on first execution (records were
clean because record-along passes are served by the live encodes). E2B's
shard sits entirely under 2^32, which is the whole model split.

Proof: TestVerifyStackICBReplay_RMSAddTwoLayerParity_Good/e4b-2560-2layer-shard4g
— identical two-layer rms/add stream, weights at 4.0001GiB offsets, replay
diverged from live at cos 0.75 with every smaller-offset variant byte-exact.

Fix: verifyStackRecorder.captureBind fails the recording on any bind offset
>= 2^32 — the lane auto-declines on >4GiB-shard models and the live fold
serves. E4B lean pair now runs 168 tok/s clean with NO kill-switch env
(was: hard invalid-token abort without LTHN_VERIFY_STACK_ICB=0); E2B keeps
its replays (210.8 tok/s, unchanged).

Follow-up (new task): re-enable stack replay on >4GiB shards (re-materialise
small norm weights / page-aligned windowed sub-buffers over the mmap for
projections) and audit the other ICB lanes (arch decode, verify-tail, fused
chain) for the same offset class.

Co-Authored-By: Virgil <virgil@lethean.io>
…— rebase high binds onto no-copy windows

A bind at offset >= 2^32 now rebases onto a memoised page-aligned no-copy
window over the same memory at the containing 2GiB segment base — the
recorded offset drops under 2^31, the bytes are identical, nothing is
copied. The shard mmap's exact-file-size tail is page-floored (its final
partial page is mapped regardless); a bind STARTING inside that fragment
declines the recording, as does an unbuildable window (captureBind's >=2^32
guard stays as the backstop).

E4B lean pair: replays re-engage at every position, 175.8 tok/s (was 168.4
declining, 173.4 under the old env kill), output BYTE-IDENTICAL to the live
fold (LTHN_VERIFY_STACK_ICB=0 A/B). Pins: shard4g micro now asserts full
record+replay parity through the windows; TestVsRebaseHighBind_Ugly covers
the segment reuse, tail-fragment decline, and out-of-range edges.

Co-Authored-By: Virgil <virgil@lethean.io>
The #71 class closed across all four recording lanes: verify-tail declines
via fail() after an unrebasable window; the fused chain and the arch lane
rebase through the shared no-copy windows (their weights are per-tensor
buffers today, so the branch is future-proofing) and trace loudly if a
window cannot build — neither has a decline channel at the sink.

Co-Authored-By: Virgil <virgil@lethean.io>
…in the batched verify interleave, not the fold

The 12B pair (gemma-4-12B-it-4bit + bf16 assistant) diverges from the
per-row byte-exact verify lane at the first boundary and collapses to 25%
acceptance. The env-gated bisect proves the per-row reference sound and
every fold-stage lever innocent: multiq/rope/epilogue/mlp-fold all still
diverge — INCLUDING mlp-fold-off, i.e. the whole fold declined and the
batched per-row interleave serving — and the divergence point shifts
(27->17) under any lever, so the model sits on knife-edge argmax ties that
any accumulation-order delta flips. E2B/E4B/26B hold byte parity through
the same machinery; a 12B-specific op in the interleave is not
order-identical to sequential. Hunt continues in #73.

Co-Authored-By: Virgil <virgil@lethean.io>
…ings

LoadDir/LoadDirMmap knew two layouts: an index.json-mapped shard set and a
single model.safetensors. A sharded checkpoint WITHOUT an index — standard
model-NNNNN-of-NNNNN.safetensors or the model.safetensors-NNNNN-of-NNNNN
.safetensors spelling Qwen3.5 snapshots ship — was rejected outright. A new
scan route (isShardName/scanShards) now finds shard-named files in either
spelling when neither the index nor the single file exists, merged in sorted
order; a stray non-shard tensor file (adapter.safetensors) never matches, and
a tensor claimed by two shards refuses rather than silently picking a winner.

Receipts: TestSharded_LoadDir_ShardNamingVariants +
TestSharded_LoadDirMmap_ShardNamingVariants table the three naming forms;
isShardName/scanShards carry their own Good/Bad tables; the extended
TestSharded_LoadDir_Bad proves the stray-only and duplicate-tensor refusals.

Co-Authored-By: Virgil <virgil@lethean.io>
…snapshots assemble

Qwen/Qwen3.5-0.8B and -2B HF snapshots ship the current transformers
multimodal nesting — model.language_model.* text tensors beside
model.visual.* and mtp.* — but NormalizeWrapperNames only knew the classic
language_model.* wrapper prefix, so no bare model.* alias was ever created
and every load died at "model.Assemble: model.embed_tokens absent" (the
weights themselves were found fine: the snapshots' index.json maps their
model.safetensors-00001-of-00001.safetensors shard, which LoadDirMmap
already follows by name). The new wrapperStripped helper recognises both
layouts — language_model.X -> X and model.language_model.X -> model.X —
keeping the same-map second-pass return and the no-clobber rule intact, so
Assemble's bare lookups, InferFromWeights' probes and assembleGatedDelta's
linear_attn reads all resolve; model.visual.*/mtp.* pass through untouched.
engine/hip's DenseWeightNameCandidates already lists this prefix as a
standard alias — this brings the factory route level.

Receipts: TestWrapperNames_WrapperStripped_Good/_Bad table both prefixes and
the non-text siblings; TestWrapperNames_NormalizeWrapperNames_
NestedWrapperLayout proves the aliasing + the #60 writeback contract on the
new layout; both snapshots' weight maps verified to carry exactly the
model.language_model/model.visual/mtp prefixes, no lm_head (tied).

Co-Authored-By: Virgil <virgil@lethean.io>
…hards)

Qwen3.5 HF snapshots load: the current transformers nesting
(model.language_model.*) aliases through NormalizeWrapperNames, and
index-less shard scans accept all three safetensors naming forms.

Co-Authored-By: Virgil <virgil@lethean.io>
The hunt's verdict, receipts in the task: no bug. The greedy divergence is
the documented fold token-identity contract surfacing on 12B's knife-edge
argmax ties (every stage lever still diverges and the divergence point
moves with any reordering — the tie signature); the drafter is mid-pack on
prose (25% vs E2B's 10%); no regression exists (the July-10 era measured
pair 73.4 vs plain 73.3 — the +28% reference never reproduced); and the
family truth is that MTP acceptance is predictability-dependent everywhere,
with the low-accept bail correctly parking pairs at plain speed on prose.
12B pair stays parity-with-plain by verify economics (48-layer forward vs
mid-pack acceptance); the stack replay already serves it post-#72. The test
now logs the tie-tier behaviour instead of asserting a parity the contract
never promised.

Co-Authored-By: Virgil <virgil@lethean.io>
Snider added a commit that referenced this pull request Jul 22, 2026
design-rocm.md #11. Verdict: keep the two parsers intentionally
separate, cross-referenced — not unify. They answer different
questions: quantfmt.QuantInfo detects HOW AN EXTERNAL TOOL quantised a
checkpoint (the HuggingFace quantization_config key: gptq/awq/
compressed-tensors/fp8/bitsandbytes/quark provenance), which no
in-tree engine load path currently reads. model.QuantConfig is THIS
ENGINE'S OWN runtime dequant instructions (the MLX-native
quantization block), read directly by the assembler via For(name).
Different config keys, different shapes, different consumers, zero
shared code today — merging them would conflate an import-time
detection concern with an execution-time one for no benefit.

Both types now carry a doc-comment pointing at the other, and
design-rocm.md §B.3 records the resolution inline, so a future reader
lands on the right parser instead of building a third one for a third
format.

Co-Authored-By: Virgil <virgil@lethean.io>
Snider added a commit that referenced this pull request Jul 22, 2026
Snider and others added 6 commits July 22, 2026 10:32
docs/ now holds only documentation — the manual (architecture, backends,
build, cmd-lem, development, gui, models, interfaces, types, history,
index), the API-compat references (anthropic/ inference/ ollama/ openai/),
the state-subsystem contracts (state/), examples/, and the AX RFC. The
campaign handover, dated audits, the executed purge plan, todo, perf
notes, ten design drafts, receipts/ and superpowers/ move to the
orchestrating agent's home — working state, not user documentation.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Virgil <virgil@lethean.io>
First consumer of the freshly released go-html go/v0.11.0 (ctml parser,
terminal renderer, box map, teabox). Import + parse probed green; the
tab-bar slice lands next per the migration design.

Co-Authored-By: Virgil <virgil@lethean.io>
The panel bar is the first screen through the .ctml migration: tabs.ctml
(go:embed) parsed by ctml.Parse and rendered by html.RenderTermBoxes,
replacing the hand-composed lipgloss strip (intersperse deleted, same
visual: LEM brand + per-panel markers, palette colours via
TermTheme.Classes from style.go).

- Labels bind through ctml.Bindings + <each>, re-bound per change; the
  active tab rides its own sequence (tabsBefore/tabsActive/tabsAfter)
  because .ctml class attributes are static strings.
- Mouse added: tea.WithMouseCellMotion() on both programs, tea.MouseMsg
  in Update -> onMouse -> teabox.Resolve against the render's box map;
  clicks switch panels through the same selectPanel path as Tab/S-Tab
  (Models first-visit discovery included). Wheel keeps its transcript
  route; boot/overlay gates mirror the keyboard.
- go-html boxes block-level elements only, so per-tab boxes are derived
  from the ANSI-stripped render (mergePanelTabBoxes) and merged into the
  same BoxMap; teabox's smallest-box rule prefers tab over strip.
- README documents the idiom (markup + Bindings + theme + boxes) for the
  next slices.

Gates (cli/): go vet clean; go build clean; go test -run
'PanelBar|OnMouse|SelectPanel|WorkspaceFrame|ChooseLayout|PanelID' 21
passed; -run 'AppUpdateTransitions|RunWithWorkspace' 5 passed.

Co-Authored-By: Virgil <virgil@lethean.io>
…abs)

The proof-of-seams slice: tabs.ctml parsed and rendered through go-html
v0.11.0's terminal renderer with the palette mapped onto TermTheme classes,
per-tab mouse switching resolved through the box map + teabox (mouse
enabled for the first time), old lipgloss composition deleted. 374 tui
tests green. The lane's go-html friction report (inline boxes, row-scoped
each styling, interpolation, whitespace) feeds upstream before slice 2.

Co-Authored-By: Virgil <virgil@lethean.io>
…anged

The #51 rewrite left main (the squash-merge release line) and dev sharing
only the ancient root, so the dev->main PR conflicts structurally. This
ours-strategy merge makes main an ancestor of dev with dev's tree byte-for-
byte unchanged; the promotion PR becomes a fast-forward and every future
dev->main merge is clean.

Co-Authored-By: Virgil <virgil@lethean.io>
@Snider
Snider merged commit 0036245 into main Jul 22, 2026
1 check passed
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
4.8% Duplication on New Code (required ≤ 3%)
E Reliability Rating on New Code (required ≥ A)
D Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

💡 Need a hand with PR review? Try Gitar by Sonar!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants